SA-MP Forums Archive
[AJUDA] Ajuda com comando. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] Ajuda com comando. (/showthread.php?tid=166981)



[AJUDA] Ajuda com comando. - Pawn - 10.08.2010

Fiz um comando de colete:

pawn Код:
if(strcmp(cmdtext, "/Colete", true) == 0)
{
GivePlayerMoney(playerid, -2000);
SetPlayerArmour(playerid,100.0);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "* '%s' comprou um Colete | Comando: '/colete'.", pname);
SendClientMessageToAll(0xd6deacAA, string);
GameTextForPlayer(playerid,"~w~COLETE ~n~  ~y~Comprado", 3000, 5);
return 1;
}
Mas eu quero que o player compre um colete por morte... Oque eu modifico?


Re: [AJUDA] Ajuda com comando. - gunslinger - 10.08.2010

Код:
 new colete[MAX_PLAYERS];   // topo
Код:
public OnPlayerDeath(playerid, killerid, reason) // no onplayerdeath
{
colete[playerid]=0;
return 1;
}
Код:
if(strcmp(cmdtext, "/Colete", true) == 0)
{
GivePlayerMoney(playerid, -2000);
SetPlayerArmour(playerid,100.0);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "* '%s' comprou um Colete | Comando: '/colete'.", pname);
SendClientMessageToAll(0xd6deacAA, string);
GameTextForPlayer(playerid,"~w~COLETE ~n~  ~y~Comprado", 3000, 5);
colete[playerid]=1;
return 1;
}



Re: [AJUDA] Ajuda com comando. - Pawn - 10.08.2010

Fiz isso e nгo deu certo...

O GM compilou certinho...

Mas o comando aidna nгo da pra fazer uma vez por morte..


Re: [AJUDA] Ajuda com comando. - zSuYaNw - 10.08.2010

POde fazer assim :

pawn Код:
new Colete[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
Colete[playerid] += 10;//ele sу pode usar 10 veses
return 1;
}

if(strcmp(cmdtext, "/Colete", true) == 0)
{
 if(Colete[playerid] == 5 || 4|| 3 || 2 || 1)
 {
 GivePlayerMoney(playerid, -2000);
 SetPlayerArmour(playerid,100.0);
 new pname[MAX_PLAYER_NAME];
 GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
 format(string, sizeof(string), "* '%s' comprou um Colete | Comando: '/colete'.", pname);
 SendClientMessageToAll(0xd6deacAA, string);
 GameTextForPlayer(playerid,"~w~COLETE ~n~  ~y~Comprado", 3000, 5);
 Colete[playerid]-=1;
 else if(Colete[playerid] == 0)
 {
  SendClientMessage(playerid,0xd6deacAA,"Vocк nгo tem Vale Colete");
 }
 return 1;
}



Re: [AJUDA] Ajuda com comando. - SuB_ZeRo0_ - 10.08.2010

Quote:
Originally Posted by gunslinger
Посмотреть сообщение
Код:
 new colete[MAX_PLAYERS];   // topo
Код:
public OnPlayerDeath(playerid, killerid, reason) // no onplayerdeath
{
colete[playerid]=0;
return 1;
}
Код:
if(strcmp(cmdtext, "/Colete", true) == 0)
{
GivePlayerMoney(playerid, -2000);
SetPlayerArmour(playerid,100.0);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "* '%s' comprou um Colete | Comando: '/colete'.", pname);
SendClientMessageToAll(0xd6deacAA, string);
GameTextForPlayer(playerid,"~w~COLETE ~n~  ~y~Comprado", 3000, 5);
colete[playerid]=1;
return 1;
}
Faltou no comando:

pawn Код:
if(colete[playerid]==1) return SendClientMessage(playerid,0xd6deacAA,"ERRO: Apenas um colete por morte!");



Re: [AJUDA] Ajuda com comando. - ipsBruno - 10.08.2010

pawn Код:
new bool:colete[MAX_PLAYERS];   // topo
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) // no onplayerdeath
{
colete[playerid]=false;
return 1;
}
pawn Код:
if(strcmp(cmdtext, "/Colete", true) == 0)
{
if(colete[playerid]==true) return SendClientMessage(playerid,0xd6deacAA,"ERRO: Apenas um colete por morte!");//І no SubZero
GivePlayerMoney(playerid, -2000);
SetPlayerArmour(playerid,100.0);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "* '%s' comprou um Colete | Comando: '/colete'.", pname);
SendClientMessageToAll(0xd6deacAA, string);
GameTextForPlayer(playerid,"~w~COLETE ~n~  ~y~Comprado", 3000, 5);
colete[playerid]=true;
return 1;
}
Usem Bool quando й para Verdadeiro e Falso...