08.07.2010, 21:24
pawn Код:
if(strcmp(x_nr,"drugs",true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /anna drugs [playerid/PartOfName] [amount]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(giveplayerid,x,y,z);
if(!PlayerToPoint(5, playerid, x, y, z))
{
SendClientMessage(playerid, COLOR_GRAD1, " Player is not near you!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /anna drugs [playerid/PartOfName] [amount]");
return 1;
}
new asammount;
asammount = strval(tmp);
//if(asammount >= PlayerInfo[playerid][pDrugs]) { SendClientMessage(playerid, COLOR_GREY, " You don't have so many drugs."); return 1; }
if(PlayerInfo[playerid][pDrugs] > asamount) return SendClientMessage(playerid,COLOR_GRAD1,"You dont have many drugs!");
GetPlayerName(playerid, sendername, sizeof(sendername));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
PlayerInfo[playerid][pDrugs] -= asammount;
PlayerInfo[giveplayerid][pDrugs] += asammount;
if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "* %s takes out his sack with drugs and hands it to %s.", sendername, giveplayer); }
else { format(string, sizeof(string), "* %s takes out her sack with drugs and hands it to %s.", sendername, giveplayer); }
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Player is Offline!");
return 1;
}
}