01.03.2010, 22:31
Hello. I made a /sellgun [playerid/PartOfName] [weaponname] [price] command. But when a I testing it. The tmps are messed up.
its like /sellgun price ..........something here.
So what do I have to change so the cmdtext is fine?
My command is not finnished and a little bit messed up I gues:
its like /sellgun price ..........something here.
So what do I have to change so the cmdtext is fine?
My command is not finnished and a little bit messed up I gues:
Код:
if(strcmp(cmd,"/sellgun",true)==0) { if (PlayerStats[playerid][Job] != 1) { SendClientMessage(playerid,COLOR_GREY,"You are not a Arms Dealer!"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_RED, " Usage: /sellgun [playerid/PartOfName] [price] [weaponname] "); SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 1: Katana(100A) Shovel(100A) bat(100A) Cane{100A) Purple Dildo(25A) flowers(25A) sdpistol(200A) shotgun(500B)"); if(PlayerStats[playerid][pArmsJob] >= 50) { SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 2: Mp5(500C) 9mm(300B) "); } if(PlayerStats[playerid][pArmsJob] >= 100) { SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 3: Country Rifle(200B-500C)"); } if(PlayerStats[playerid][pArmsJob] >= 150) { SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 4: Ak47(1000A-500B) M4(1000A-800B)"); } if(PlayerStats[playerid][pArmsJob] >= 200) { SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 5: Spas12(1200B-1000C) Desert Deagle(1200B-1200C)"); } return 1; } giveplayerid = ReturnUser(tmp); new gunprice = strval(tmp); if(gunprice < 1 || gunprice > 99999) { SendClientMessage(playerid, COLOR_RED, "You cannot sell a weapon for more then $100.000 or less then $1"); return 1; } new x_weapon[256]; if (IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { x_weapon = strtok(cmdtext, idx); if(!strlen(x_weapon)) { SendClientMessage(playerid, COLOR_RED, " Usage: /sellgun [playerid/PartOfName] [price] [weaponname] "); SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 1: Katana(100A) Shovel(100A) bat(100A) flowers(25A) sdpistol(200A) shotgun(500B)"); if(PlayerStats[playerid][pArmsJob] >= 50) { SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 2: Mp5(500C) 9mm(300B) "); } if(PlayerStats[playerid][pArmsJob] >= 100) { SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 3: Country Rifle(200B-500C)"); } if(PlayerStats[playerid][pArmsJob] >= 150) { SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 4: Ak47(1000A-500B) M4(1000A-800B)"); } if(PlayerStats[playerid][pArmsJob] >= 200) { SendClientMessage(playerid, COLOR_WHITE, "Weapons Level 5: Spas12(1200B-1000C) Desert Deagle(1200B-1200C)"); } return 1; } if(strcmp(x_weapon,"sdpistol",true) == 0) { if(PlayerStats[playerid][MaterialsA] > 99) { sellweapon[playerid] = 23; sellweapon[giveplayerid] = 23; weaponprice[giveplayerid] = gunprice; fromplayer[giveplayerid] = playerid; } else { SendClientMessage(playerid,COLOR_RED," Not enough Materials for that Weapon!"); return 1; } } format(string, sizeof(string), " %s Want to sell you a %s for $%d Usage /accept gun to accept it.", GetPlayerNameEx(playerid),x_weapon,gunprice); SendClientMessage(giveplayerid, COLOR_YELLOW, string); } else { SendClientMessage(playerid, COLOR_RED, "Invalid player ID!"); } } else { SendClientMessage(playerid, COLOR_RED, "Invalid player ID!"); } return 1; } }