11.06.2012, 15:33
Bom enfim Tenho Algumas Duvidas Ainda Sobre Essa Conversao de strcmp para zcmd e sscanf!!
Esse Comando Como Seria??
Ou Seria Melhor Em Dialog?
Esse Comando o Que Esta Errado?
PS: Esse GM e Um RPG!!
Desde Ja Obrigado!!
Esse Comando Como Seria??
pawn Код:
if(strcmp(cmd, "/comprar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (!PlayerToPoint(100, playerid,-30.875, -88.9609, 1004.53))//centerpoint 24-7
{
SendClientMessage(playerid, COLOR_GRAD2, " Vocк nгo esta em uma 24/7!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USE: /comprar [Numero do Item]");
SendClientMessage(playerid, COLOR_GREEN, "|_______ 24-7 _______|");
SendClientMessage(playerid, COLOR_GRAD1, "| 1: Celular $500 2: Raspadinha da Sorte $7500");
SendClientMessage(playerid, COLOR_GRAD2, "| 3: Agenda Telefonica $5000 4: Dados $500");
SendClientMessage(playerid, COLOR_GRAD3, "| 5: Chave do ultimo veiculo $5000 6: Chave do seu veiculo $10000");
SendClientMessage(playerid, COLOR_GRAD4, "| 7: Carteira de Cigarro $2500 8: Camisinha $50");
SendClientMessage(playerid, COLOR_GRAD5, "| 9: CD-Player $2500 10: Galinha Congelada $10");
SendClientMessage(playerid, COLOR_GRAD5, "| 11: Hamburguer $10 12: Pizza Congelada $10");
return 1;
}
new item = strval(tmp);
/*if(SBizzInfo[9][sbProdutos] == 0)
{
GameTextForPlayer(playerid, "~r~Falta Produtos", 5000, 1);
return 1;
} */
if (item == 1 && GetPlayerMoneyEx(playerid) > 500)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 500 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 500 - price;
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
GivePlayerMoneyEx(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout);
}
else
{
format(string, sizeof(string), "~r~-$%d", 500);
GameTextForPlayer(playerid, string, 5000, 1);
GivePlayerMoneyEx(playerid,-500);
SBizzInfo[9][sbTill] += 500;
ExtortionSBiz(9, 500);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
new randphone = 1000 + random(9999);//minimum 1000 max 9999
PlayerInfo[playerid][pPnumber] = randphone;
format(string, sizeof(string), " Vocк comprou um celular, novo nъmero: %d", randphone);
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_GRAD5, "Vocк pode verificar isso a qualquer momento digitando /rg");
SendClientMessage(playerid, COLOR_WHITE, "DICA: Agora vocк pode digitar /ajuda para ver os comandos de celular.");
return 1;
}
else if (item == 2 && GetPlayerMoneyEx(playerid) > 7500)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 7500 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 7500 - price;
GivePlayerMoneyEx(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid,-7500);
SBizzInfo[9][sbTill] += 7500;
ExtortionSBiz(9, 7500);
format(string, sizeof(string), "~r~-$%d", 1000);
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
new prize;
new symb1[32]; new symb2[32]; new symb3[32];
new randcard1 = random(10);//minimum 1000 max 9999
new randcard2 = random(10);//minimum 1000 max 9999
new randcard3 = random(10);//minimum 1000 max 9999
if(randcard1 >= 5)
{
format(symb1, sizeof(symb1), "~b~]");
randcard1 = 1;
}
else if(randcard1 <= 4 && randcard1 >= 2)
{
format(symb1, sizeof(symb1), "~g~]");
randcard1 = 2;
}
else if(randcard1 < 2)
{
format(symb1, sizeof(symb1), "~y~]");
randcard1 = 3;
}
if(randcard2 >= 5)
{
format(symb2, sizeof(symb2), "~b~]");
randcard2 = 1;
}
else if(randcard2 <= 4 && randcard2 >= 2)
{
format(symb2, sizeof(symb2), "~g~]");
randcard2 = 2;
}
else if(randcard2 < 2)
{
format(symb2, sizeof(symb2), "~y~]");
randcard2 = 3;
}
if(randcard3 >= 5)
{
format(symb3, sizeof(symb3), "~b~]");
randcard3 = 1;
}
else if(randcard3 <= 4 && randcard3 >= 2)
{
format(symb3, sizeof(symb3), "~g~]");
randcard3 = 2;
}
else if(randcard3 < 2)
{
format(symb3, sizeof(symb3), "~y~]");
randcard3 = 3;
}
if(randcard1 == randcard2 && randcard1 == randcard3)
{
if(randcard1 > 5)
{
prize = 2500;
}
if(randcard1 <= 4 && randcard1 >= 2)
{
prize = 1500;
}
if(randcard1 < 2)
{
prize = 500;
}
GivePlayerMoneyEx(playerid,prize);
SBizzInfo[9][sbTill] -= prize;
ExtortionSBiz(9, prize);
format(string, sizeof(string), "%s %s %s ~n~~n~~w~~g~$%d",symb1,symb2,symb3, prize);
}
else
{
format(string, sizeof(string), "%s %s %s ~n~~n~~w~~r~$0",symb1,symb2,symb3);
}
GameTextForPlayer(playerid, string, 3000, 3);
return 1;
}
else if (item == 3 && GetPlayerMoneyEx(playerid) > 5000)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 5000 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 5000 - price;
GivePlayerMoneyEx(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid,-5000);
SBizzInfo[9][sbTill] += 5000;
ExtortionSBiz(9, 5000);
format(string, sizeof(string), "~r~-$%d", 5000);
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
PlayerInfo[playerid][pPhoneBook] = 1;
format(string, sizeof(string), " Vocк comprou uma Agenda Telefуnica, agora vocк pode ver o nъmero de outros jogadores!");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "DICA: Use /numero [ID/Nome].");
return 1;
}
else if (item == 4 && GetPlayerMoneyEx(playerid) > 500)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 500 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 500 - price;
GivePlayerMoneyEx(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid,-500);
SBizzInfo[9][sbTill] += 500;
ExtortionSBiz(9, 500);
format(string, sizeof(string), "~r~-$%d", 500);
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
gDice[playerid] = 1;
format(string, sizeof(string), " Vocк comprou dados, agora vocк pode jogar aos dados.");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "DICA: Use /dados ");
return 1;
}
else if(item == 5 && GetPlayerMoneyEx(playerid) > 5000)
{
if (gLastCar[playerid] != 0)
{
if(HireCar[playerid] != 999)
{
gCarLock[HireCar[playerid]] = 0;
UnLockCar(HireCar[playerid]);
HireCar[playerid] = 999;
}
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 5000 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 5000 - price;
GivePlayerMoneyEx(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid,-5000);
SBizzInfo[9][sbTill] += 5000;
ExtortionSBiz(9, 5000);
format(string, sizeof(string), "~r~-$%d", 5000);
GameTextForPlayer(playerid, string, 5000, 1);
}
SBizzInfo[9][sbProdutos]--;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
HireCar[playerid] = gLastCar[playerid];
format(string, sizeof(string), "Vocк comprou uma chave e agora vocк pode trancar seu ultimo veiculo.");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "DICA: Use /trancar ");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, " Vocк nгo possui um veiculo free!");
}
return 1;
}
else if (item == 6 && GetPlayerMoneyEx(playerid) > 10000)
{
if(PlayerInfo[playerid][pPhousekey] != 255)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1 && HireCar[PlayerInfo[playerid][pPhousekey]+1])
{
HireCar[i] = 299;
}
}
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10000 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 10000 - price;
GivePlayerMoneyEx(playerid,- payout);
SBizzInfo[9][sbTill] += payout;
ExtortionSBiz(9, payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid,-10000);
SBizzInfo[9][sbTill] += 10000;
ExtortionSBiz(9, 10000);
format(string, sizeof(string), "~r~-$%d", 10000);
GameTextForPlayer(playerid, string, 5000, 1);
}
SBizzInfo[9][sbProdutos]--;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Vocк comprou uma chave.");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "DICA: Use /trancar ");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, " Vocк nгo possui um veiculo!");
}
return 1;
}
else if (item == 7 && GetPlayerMoneyEx(playerid) > 2499)
{
if(PlayerInfo[playerid][pCigarro] > 0)
{
new skill = 50 / 100;
new price = (skill)*(PlayerInfo[playerid][pCigarro]);
new payout = 50 - price;
GivePlayerMoneyEx(playerid,- payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid,-2500);
format(string, sizeof(string), "~r~-$%d", 50);
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerInfo[playerid][pCigarro] += 20;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Vocк comprou uma carteira com 20 cigarros, use /fumar para usa-los.");
SendClientMessage(playerid, COLOR_GRAD4, string);
return 1;
}
else if (item == 8 && GetPlayerMoneyEx(playerid) > 2500)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 2500 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 2500 - price;
GivePlayerMoneyEx(playerid, - payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid, - 2500);
format(string, sizeof(string), "~r~-$%d", 2500);
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "CD-Player comprado.");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "DICA: Use /musica");
PlayerInfo[playerid][pCDPlayer] = 1;
return 1;
}
else if (item == 9 && GetPlayerMoneyEx(playerid) > 2500)
{
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 2500 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 2500 - price;
GivePlayerMoneyEx(playerid, - payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid, - 2500);
format(string, sizeof(string), "~r~-$%d", 2500);
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "CD-Player comprado.");
SendClientMessage(playerid, COLOR_GRAD4, string);
SendClientMessage(playerid, COLOR_WHITE, "DICA: Use /musica");
PlayerInfo[playerid][pCDPlayer] = 1;
return 1;
}
else if (item == 10 && GetPlayerMoneyEx(playerid) > 10)
{
if(Groceries[playerid][pChickens] >= 3)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк tem muitas galinhas, Coma algumas primeiro!");
return 1;
}
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 10 - price;
GivePlayerMoneyEx(playerid, - payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid, - 10);
format(string, sizeof(string), "~r~-$%d", 10);
GameTextForPlayer(playerid, string, 5000, 1);
}
GivePlayerMoneyEx(playerid, - 10);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Galinha comprada.");
SendClientMessage(playerid, COLOR_GRAD4, string);
format(string, sizeof(string), "~r~-$%d", 10);
GameTextForPlayer(playerid, string, 5000, 1);
new rand = random(15);
Groceries[playerid][pChickens] += 1;
Groceries[playerid][pChicken] += rand;
return 1;
}
else if (item == 11 && GetPlayerMoneyEx(playerid) > 10)
{
if(Groceries[playerid][pHamburgers] >= 3)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк tem muitos hamburgueres, Coma alguns primeiro!");
return 1;
}
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 10 - price;
GivePlayerMoneyEx(playerid, - payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid, - 10);
format(string, sizeof(string), "~r~-$%d", 10);
GameTextForPlayer(playerid, string, 5000, 1);
}
GivePlayerMoneyEx(playerid, - 10);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Hamburguer comprado.");
SendClientMessage(playerid, COLOR_GRAD4, string);
format(string, sizeof(string), "~r~-$%d", 10);
GameTextForPlayer(playerid, string, 5000, 1);
new rand = random(15);
Groceries[playerid][pHamburgers] += 1;
Groceries[playerid][pHamburger] += rand;
return 1;
}
else if (item == 12 && GetPlayerMoneyEx(playerid) > 10)
{
if(Groceries[playerid][pPizzas] >= 3)
{
SendClientMessage(playerid, COLOR_GREY, " Vocк tem muitas pizzas, Coma algumas primeiro!");
return 1;
}
if(PlayerInfo[playerid][pTraderPerk] > 0)
{
new skill = 10 / 100;
new price = (skill)*(PlayerInfo[playerid][pTraderPerk]);
new payout = 10 - price;
GivePlayerMoneyEx(playerid, - payout);
format(string, sizeof(string), "~r~-$%d", payout);
GameTextForPlayer(playerid, string, 5000, 1);
}
else
{
GivePlayerMoneyEx(playerid, - 10);
format(string, sizeof(string), "~r~-$%d", 10);
GameTextForPlayer(playerid, string, 5000, 1);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "Pizza comprada.");
SendClientMessage(playerid, COLOR_GRAD4, string);
new rand = random(15);
Groceries[playerid][pPizzas] += 1;
Groceries[playerid][pPizza] += rand;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, " Vocк nгo possui essa grana!");
}
}
return 1;
}
Ou Seria Melhor Em Dialog?
Esse Comando o Que Esta Errado?
pawn Код:
CMD:desbanip(playerid,params)
{
new string[100], gstring[50], IP;
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(modoadmin[playerid] < 1)return SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб em modo de trabalho!");
if(sscanf(params, "i",IP))return SendClientMessage(playerid,-1,"Use: desbaip [IP DO JOGADOR]");
format(gstring, 128, "IPsBanidos/%s.ini", IP);
if(!dini_Exists(gstring))return SendClientMessage(playerid,COLOR_GRAD1,"IP nгo encontrado na base de dados");
dini_Remove(gstring);
fremove(gstring);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 128, "Vocк desbaniu o IP %s se ainda nгo desbaniu a conta use /desbanconta.",IP);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
}
return 1;
}
Desde Ja Obrigado!!