09.11.2010, 20:55
Код:
new x_nr[24]; x_nr = strtok(cmdtext, idx); if(!strlen(x_nr))
Код:
else if(strcmp(x_nr,"mats",true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /give mats [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(!IsPlayerInRangeOfPoint(playerid, 5, 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: /give mats [playerid/PartOfName] [amount]"); return 1; } new mammount; mammount = strval(tmp); if(mammount > PlayerInfo[playerid][pMats]) { SendClientMessage(playerid, COLOR_GREY, " You don't have so many mats."); return 1; } GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); PlayerInfo[playerid][pMats] += mammount; PlayerInfo[giveplayerid][pMats] += mammount; if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "* %s takes out his sack with mats and hands it to %s.", sendername, giveplayer); } else { format(string, sizeof(string), "* %s takes out her sack with mats and hands it to %s.", sendername, giveplayer); } ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5); new y1, m, d; new h,mi,s; getdate(y1,m,d); gettime(h,mi,s); format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /give mats %s %d",d,m,y1,h,mi,s,sendername,giveplayer, mammount); CommandLog(string); } } else { SendClientMessage(playerid, COLOR_GRAD1, " Player is Offline!"); return 1; }