- เครดิต
- 6
- ความรู้
-
- เงิน $
-
- ความดี
-
|
ตัวแปรทั้งหมด
new deaglevirtualworld = 0;
new PlayerDeagle[MAX_PLAYERS];
new PlayerDeagleStart[MAX_PLAYERS];
new PlayerDeagleMoney[MAX_PLAYERS];
new Float:TeleportDeagle[MAX_PLAYERS][3];
new interiordeagle[MAX_PLAYERS];
new virtualworlddeagle[MAX_PLAYERS];
new respawndeagle[MAX_PLAYERS];
new Float:OldHealthDeagle[MAX_PLAYERS];
new Float:OldArmourDeagle[MAX_PLAYERS];
new PlayerWeaponDeagle[MAX_PLAYERS][13];
new PlayerAmmoDeagle[MAX_PLAYERS][13];
new DeagleOnline[MAX_PLAYERS];
เอา PlayerDeagle[playerid] = 999; PlayerDeagleMoney[playerid] = 999; PlayerDeagleStart[playerid] = 0;ไปไว้ใน public OnPlayerConnect(playerid)
ค้นหา public OnPlayerDeath(playerid, killerid, reason)
แทรกนี้เข้าไป
i if(PlayerDeagleStart[playerid] == 1)
{
if(PlayerDeagleStart[killerid] == 1)
{
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
GetPlayerName(playerid, name, sizeof(name));
PlayerDeagleStart[playerid] = 0;
PlayerDeagleStart[killerid] = 0;
format(string, 128, "PVP News: %s ได้ชนะ %s จากการดวล Desert Eagle", killer, name);
SendClientMessageToAll(COLOR_LIGHTGREEN, string);
SpawnPlayer(killerid);
SetTimerEx("SetPlayerToSpawn", 5000, 0, "d", playerid);
SafeGivePlayerMoney(killerid,PlayerDeagleMoney[playerid]);
SafeGivePlayerMoney(playerid,-PlayerDeagleMoney[playerid]);
PlayerDeagleMoney[playerid] = 0;
PlayerDeagleMoney[killerid] = 0;
}
return 1;
}
ต่อมาค้นหา if(strcmp(cmd,"/accept",true)==0)
และเสียบ
else if(strcmp(x_job,"deagle",true) == 0)
{
if(PlayerDeagle[playerid] < 999)
{
GetPlayerHealth(playerid, OldHealthDeagle[playerid]);
GetPlayerArmour(playerid, OldArmourDeagle[playerid]);
GetPlayerHealth(PlayerDeagle[playerid], OldHealthDeagle[PlayerDeagle[playerid]]);
GetPlayerArmour(PlayerDeagle[playerid], OldArmourDeagle[PlayerDeagle[playerid]]);
for (new i; i<13; i++)
{
GetPlayerWeaponData(playerid, i, PlayerWeaponDeagle[playerid], PlayerAmmoDeagle[playerid]);
}
for (new i; i<13; i++)
{
GetPlayerWeaponData(PlayerDeagle[playerid], i, PlayerWeaponDeagle[PlayerDeagle[playerid]], PlayerAmmoDeagle[PlayerDeagle[playerid]]);
}
interiordeagle[playerid] = GetPlayerInterior(playerid);
GetPlayerPos(playerid, TeleportDeagle[playerid][0],TeleportDeagle[playerid][1],TeleportDeagle[playerid][2]);
virtualworlddeagle[playerid] = GetPlayerVirtualWorld(playerid);
respawndeagle[playerid] = 1;
interiordeagle[PlayerDeagle[playerid]] = GetPlayerInterior(PlayerDeagle[playerid]);
GetPlayerPos(PlayerDeagle[playerid], TeleportDeagle[PlayerDeagle[playerid]][0],TeleportDeagle[PlayerDeagle[playerid]][1],TeleportDeagle[PlayerDeagle[playerid]][2]);
virtualworlddeagle[PlayerDeagle[playerid]] = GetPlayerVirtualWorld(PlayerDeagle[playerid]);
respawndeagle[PlayerDeagle[playerid]] = 1;
GetPlayerName(PlayerDeagle[playerid], giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), " คุณได้รับคำท้าดวล Desert Eagle ของ %s ค่าดวล %d", giveplayer, PlayerDeagleMoney[playerid]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), " %s ได้รับคำท้าดวล Desert Eagle ของคุณค่าดวล %d", sendername, PlayerDeagleMoney[playerid]);
SendClientMessage(PlayerDeagle[playerid], COLOR_GREY, string);
deaglevirtualworld++;
SafeResetPlayerWeapons(playerid);
SafeResetPlayerWeapons(PlayerDeagle[playerid]);
SafeGivePlayerWeapon(playerid,24,350);
SafeGivePlayerWeapon(PlayerDeagle[playerid],24,350);
SetPlayerHealth(playerid,100);
SetPlayerHealth(PlayerDeagle[playerid],100);
SetPlayerArmour(playerid,0);
SetPlayerArmour(PlayerDeagle[playerid],0);
PlayerDeagleStart[playerid] = 1;
PlayerDeagleStart[PlayerDeagle[playerid]] = 1;
SetPlayerPos(playerid,-1443.3085,997.4969,1024.2202);
SetPlayerPos(PlayerDeagle[playerid],-1357.3287,994.5474,1024.0209);
SetPlayerInterior(playerid,15);
SetPlayerInterior(PlayerDeagle[playerid],15);
SetPlayerVirtualWorld(playerid, deaglevirtualworld);
SetPlayerVirtualWorld(PlayerDeagle[playerid], deaglevirtualworld);
PlayerDeagleMoney[PlayerDeagle[playerid]] = PlayerDeagleMoney[playerid];
PlayerDeagle[playerid] = 999;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " ยังไม่มีใครท้าดวล Deagle คุณ !");
return 1;
}
}
ไว้ล่างๆหน่อยนะ ไกล้ๆกับจุดจบของ accept
เอาข้างล่างไปไว้ไหนก็ได้ใน Funtion ( เขียนถูกมะเนีย)
if (strcmp(cmd, "/deagle", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pLevel] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /deagle [playerid/PartOfName] [money]");
return 1;
}
if(PlayerDeagleStart[playerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " คุณกำลังดวล Desert Eagle อยู่");
return 1;
}
if(WantedLevel[playerid] != 0)
{
SendClientMessage(playerid, COLOR_GREY, " คุณมีค่าความต้องการตัวอยู่");
return 1;
}
if(DeagleOnline[playerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " คุณปิดการท้าดวลอยู่ !");
return 1;
}
new money;
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /deagle [playerid/PartOfName] [money]");
return 1;
}
if(money < 1) { SendClientMessage(playerid, COLOR_GREY, " ค่าดวลห้ามน้อยกว่า $1 !"); return 1; }
if(ScriptMoney[playerid] < money)
{
SendClientMessage(playerid, COLOR_GREY, " คุณมีเงินไม่พอ !");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PlayerDeagleStart[giveplayerid] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " ผู้เล่นนี้กำลังดวล Desert Eagle อยู่");
return 1;
}
if(WantedLevel[giveplayerid] != 0)
{
SendClientMessage(playerid, COLOR_GREY, " ผู้เล่นนี้มีค่าความต้องการตัวอยู่");
return 1;
}
if(ScriptMoney[giveplayerid] < money)
{
SendClientMessage(playerid, COLOR_GREY, " ผู้เล่นนี้มีเงินไม่พอค่าดวล !");
return 1;
}
if(DeagleOnline[giveplayerid] > 0)
{
SendClientMessage(playerid, COLOR_GREY, " ผู้เล่นท่านนี้ปิดการท้าดวล !");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerDeagle[giveplayerid] = playerid;
PlayerDeagleMoney[giveplayerid] = money;
format(string, sizeof(string), " คุณได้ท้า %s ดวล Desert Eagle ค่าดวล %d", giveplayer,money);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), " %s ได้ท้าคุณดวล Desert Eagle ค่าดวล %d (พิมพ์ /accept deagle เพื่อตอบรับ)", sendername,money);
SendClientMessage(giveplayerid, COLOR_GREY, string);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " No Such Player");
return 1;
}
}
else
{
return 1;
}
}
return 1;
} |
|