[AJUDA] Ajuda com comando.
#1

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?
Reply
#2

Код:
 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;
}
Reply
#3

Fiz isso e nгo deu certo...

O GM compilou certinho...

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

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;
}
Reply
#5

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!");
Reply
#6

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)