Problem with /duel cmd need help -
MBilal - 14.02.2015
The Problem is that how i can save the Playerid who want to duel with the other guy... because i want to use his ID also the Cash amount ..in /accept cmd
Код:
CMD:duel(playerid, params[])
{
new ID,weap,cost;
if(sscanf(params, "uii",ID,weap, cost)) return SCM(playerid, 0xFFFF00AA, "/duel ID [weapon ID] [cash]");
if(Duel[playerid]==1)return SCM(playerid, 0xFFFF00AA, "You already in duel.)");
if(!IsPlayerConnected(ID)) return SCM(playerid, 0xFFFF00AA, "Player is not connected.))");
if(ID == playerid) return SCM(playerid, 0xFFFF00AA, "Invalid ID.");
if(GetPlayerMoney(playerid) < cost)return SCM(playerid, 0xFFFF00AA, "You dont have that much cash.");
else
{
weapNam[playerid]=weap;
Amount[playerid]=cost;
format(Message, 128, "%s has invite you to duel with him with weapon : %s and with winning Amount %d", GetName(playerid),weapNam[playerid],Amount[playerid]);
SCM(ID, 0xFFFF00AA, Message);
Invite[ID]=1;
DuelID[playerid]=playerid; // I'm trying to saving playerid here...
}
return 1;
}
CMD:accept(playerid, params[])
{
if(Duel[playerid]==1)return SCM(playerid, 0xFFFF00AA, "You already in duel.))");
if(Invite[playerid]!=1)return SCM(playerid, 0xFFFF00AA, "You're not invited on any duel.))");
if(GetPlayerMoney(playerid) < Amount[playerid])return SCM(playerid, 0xFFFF00AA, "You dont have that much cash.");
else if (strcmp(params,"1",true) == 0)
{
ResetPlayerWeapons(playerid);
ResetPlayerWeapons(DuelID[playerid]);
format(Message,sizeof(Message),"The duel between %s(%i) and %s(%i) has started",GetName(DuelID[playerid]),DuelID[playerid],GetName(DuelID[playerid]),playerid);
SCMToAll(COLOR_YELLOW,Message);
SetPlayerInterior(playerid,10);SetPlayerInterior(DuelID[playerid],10);
SetPlayerPos(playerid,-973.190856,1060.630981,1345.674316);SetPlayerPos(DuelID[playerid],-1132.407104,1057.550781,1346.410034);
SetPlayerFacingAngle(playerid,88.169311);SetPlayerFacingAngle(DuelID[playerid],268.964355);
GivePlayerWeapon(playerid,weapNam[playerid],2000);
GivePlayerWeapon(DuelID[playerid],weapNam[playerid],2000);
Invite[playerid]=0;
Duel[playerid]=1;
Duel[DuelID[playerid]]=1;
}
else if (strcmp(params,"0",true) == 0)
{
Duel[playerid]=0;
Duel[DuelID[playerid]]=0;
Invite[playerid]=0;
SCM(DuelID[playerid], -1, "Your Oponent refuse to duel with you.");
}
return 1;
}
Re: Problem with /duel cmd need help -
Golf - 14.02.2015
to save player id
PHP код:
DuelID[playerid]= GetPlayerID(GetName(playerid));
Re: Problem with /duel cmd need help -
MBilal - 14.02.2015
and how to save the ammount which i want to give to winner?
Re: Problem with /duel cmd need help -
Golf - 14.02.2015
PHP код:
GivePlayerMoney(killerid, Amount[playerid]);
Re: Problem with /duel cmd need help -
MBilal - 14.02.2015
Код:
if(Duel[killerid]==1 && Duel[playerid]==1)
{
Duel[killerid]=0;
Duel[playerid]=0;
format(Message, 128, "SERVER : %s have win the duel challenge against %s and got %d",GetName(killerid),GetName(playerid),Amount[playerid]);
SCMToAll(COLOR_YELLOW,Message);
GivePlayerCash(killerid, Amount[playerid]);
GivePlayerCash(playerid, GetPlayerMoney(playerid)-Amount[playerid]);
}
I'm doing this OnPlayerDeath
But it not giving that amount. why ?
Re: Problem with /duel cmd need help -
Golf - 14.02.2015
now try this :
PHP код:
if(killerid == DuelID[killerid])
{
GivePlayerCash(killerid, Amount[killerid]);
}
else
{
GivePlayerCash(killerid, Amount[playerid]);
}