27.11.2012, 11:13
(
Последний раз редактировалось NeroX98; 27.11.2012 в 12:22.
)
/give droga works, but /give mats doesnt...
Код:
CMD:give(playerid, params[]) { if(isnull(params)) { SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[Koriscenje]:{FFFFFF} /give [name]"); SendClientMessage(playerid, COLOR_WHITE, "Stvari za davanje: droga, mats, oruzje, jaze"); return 1; } if(strcmp(params, "droga", true, 5) == 0) { new giveplayerid; new giveplayer[MAX_PLAYER_NAME] new sendername[MAX_PLAYER_NAME] new dammount; new string[126]; strdel(params, 0, 5); if(sscanf(params, "ui", giveplayerid, dammount)) return SendClientMessage(playerid, BLCRVENA, "{FF0000}[Koriscenje]:{FFFFFF} /give droga [ID / Del od imeto na igracot] [kolicina]"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[giveplayerid][pLevel] < 2) { SendClientMessage(playerid, COLOR_YELLOW, " Igrac mora biti minimum level 2! "); return 1; } 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, " Igrac nije blizu vas!"); return 1; } if(dammount > PlayerInfo[playerid][pDrugs]) { SendClientMessage(playerid, COLOR_YELLOW, " Nemate toliko droge kod sebe."); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); PlayerInfo[playerid][pDrugs] -= dammount; PlayerInfo[giveplayerid][pDrugs] += dammount; format(string, sizeof(string), "* %s uzima svoj paket droge i daje ga %s-u.", sendername, giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } } else { SendClientMessage(playerid, COLOR_GRAD1, " Igrac je offline!"); return 1; } } else if(strcmp(params, "mats", true, 6) == 0) { new igrac; new giveplayer[MAX_PLAYER_NAME] new sendername[MAX_PLAYER_NAME] new matskolicina; new string[126]; strdel(params, 0, 6); if(sscanf(params, "ui", igrac, matskolicina)) return SendClientMessage(playerid, BLCRVENA, "{FF0000}[Koriscenje]:{FFFFFF} /give mats [ID Igraca/Dio Imena] [amount]"); if(IsPlayerConnected(igrac)) { if(PlayerInfo[igrac][pLevel] < 2) { SendClientMessage(playerid, COLOR_YELLOW, " Igrac mora biti minimum level 2! "); return 1; } if(igrac != INVALID_PLAYER_ID) { new Float:x, Float:y, Float:z; GetPlayerPos(igrac,x,y,z); if(!PlayerToPoint(5, playerid, x, y, z)) { SendClientMessage(playerid, COLOR_GRAD1, " Igrac nije blizu vas!"); return 1; } if(matskolicina > PlayerInfo[playerid][pDrugs]) { SendClientMessage(playerid, COLOR_YELLOW, " Nemate toliko materijala."); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(igrac, giveplayer, sizeof(giveplayer)); PlayerInfo[playerid][pMats] -= matskolicina; PlayerInfo[igrac][pMats] += matskolicina; format(string, sizeof(string), "* %s uzima svoj paket druge i daje ga %s-u.", sendername, giveplayer); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } } else { SendClientMessage(playerid, COLOR_GRAD1, " Igrac je offline!"); return 1; } } return 1; }