16.04.2013, 01:32
pawn Код:
CMD:giveweed(playerid,params[])
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, x,y,z)) //Change to your needs
{
if(PlayerInfo[playerid][pJob] == 1)
{
new targetid,type,string[128];
new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid,Name,sizeof(Name));
if(sscanf(params, "ud", targetid, type)) return SendClientMessage(playerid, -1, "[Usage]: /giveweed [Part of Name/Player ID] [Amount]");
if(type > PlayerInfo[playerid][pWeed])return SendClientMessage(playerid,-1,"ERROR: You do not have that much amount of weeds!");
if(targetid == playerid)return SendClientMessage(playerid,-1,"ERROR: You cannot give drugs to your self!");
PlayerInfo[playerid][pWeed] -= type;
PlayerInfo[targetid][pWeed] +=type;
format(string,sizeof(string),"You have recieved (%d) weeds from %s(%d) ",type,Name,playerid);
SendClientMessage(targetid,-1,string);
}
else
{
SendClientMessage(playerid, -1, "you're not a drugdealer.");
}
}
else //If the player isn't in the specified range??
return 1;
}