28.11.2011, 19:51
I have these lines for /selldrugs,
but when i type it with the playerid nothing happens, is there smtg wrong?
but when i type it with the playerid nothing happens, is there smtg wrong?
PHP код:
if(strcmp(cmd, "/selldrugs", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] != 2)
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not a drugs dealer!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /selldrugs [playerid] [amount]");
return 1;
}
new playa;
new needed;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { return 1; }
needed = strval(tmp);
if(needed < 1 || needed > 50) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] 1-50 only."); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { return 1; }
if(needed > PlayerInfo[playerid][pDrugs]) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have that much!"); return 1; }
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, playa))
{
if(playa != playerid)
{
format(string, sizeof(string), "[INFO:] You have gave %s %d grams of drugs.", GetPlayerNameEx(playa), needed);
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string);
format(string, sizeof(string), "[INFO:] %s has just gave you %d grams of drugs.", GetPlayerNameEx(playerid), needed);
SendClientMessage(playa, COLOR_LIGHTYELLOW2, string);
PlayerInfo[playa][pDrugs] += needed;
PlayerInfo[playerid][pDrugs] -= needed;
PlayerPlayerActionMessage(playerid,playa,15.0,"has just gave some drugs to");
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't sell yourself drugs!");
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You arn't near that player!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
}
}
return 1;
}