25.11.2013, 19:36
Quote:
Eu vi um monte desses pedidos, vc msm no topico n sabia fazer a msm coisa que eu... passar de CMD pra strcmp, se vc tive-se falado q conseguiu ou se eu consegui-se n pedia ajuda, eu vi seu topico tbm.
E o /dar maconha eu queria saber como й que funciona pra dar uma variavel pra um outro playerid e tirar do playerid pra passar pra outro playerid pra eu fazer varias outras coisas. |
pawn Код:
CMD:dararma(playerid, params[])
{
new giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "[INFO] /dararma [id]");
new arma = GetPlayerWeapon(playerid);
new muni = GetPlayerAmmo(playerid);
GivePlayerWeapon(giveplayerid, arma, muni);
new msg[70], player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(msg, sizeof(msg), "Vocк deu uma arma para %s com %i de muniзгo!", giveplayer, muni);
SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
format(msg, sizeof(msg), "Vocк recebeu uma arma de %s com %i de muniзгo!", player, muni);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, msg);
RemovePlayerWeapon(giveplayerid, arma);
return 1;
}
// me passaram esse comando. sabe o que muda pra transformar pra strcmp? apenas isso:
CMD:dararma(playerid, params[])
//pra isso:
if(strcmp(cmd, "/dararma", true) == 0)
//e isso:
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "[INFO] /dararma [id]");
//pra isso:
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Para dar sua arma a alguйm, use: /darma [id]");
return 1;
}
pawn Код:
if(strcmp(cmd, "/darma", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "Para dar sua arma a alguйm, use: /darma [id]");
return 1;
}
new arma = GetPlayerWeapon(playerid);
new muni = GetPlayerAmmo(playerid);
giveplayerid = ReturnUser(tmp);
new msg[70], player[MAX_PLAYER_NAME];
GivePlayerWeapon(giveplayerid, arma, muni);
RemovePlayerWeapon(playerid, arma);
GetPlayerName(playerid, player, sizeof(player));
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(msg, sizeof(msg), "Vocк deu uma arma para %s com %i de muniзгo!", giveplayer, muni);
SendClientMessage(playerid, COLOR_LIGHTBLUE, msg);
format(msg, sizeof(msg), "Vocк recebeu uma arma de %s com %i de muniзгo!", player, muni);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, msg);
return 1;
}