if(strcmp(cmdtext, "/Colete", true) == 0) {
SetPlayerHealth(playerid, 100.0);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s comprou {FF00FF}vida {FF0000}( /health )", pname);
SendClientMessageToAll(0xFFFFAE96, string);
GivePlayerMoney(playerid, -100);
return 1;
if(strcmp(cmdtext, "/Colete", true) == 0) { SetPlayerHealth(playerid, 100.0); new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, MAX_PLAYER_NAME); format(string, sizeof(string), "%s comprou {FF00FF}vida {FF0000}( /health )", pname); SendClientMessageToAll(0xFFFFAE96, string); GivePlayerMoney(playerid, -100); return 1; |
// Topo:
new bool:JFSUmaVez[MAX_PLAYERS];
// public OnPlayerSpawn
JFSUmaVez[playerid] = false;
// comando
if(strcmp(cmdtext, "/colete", true) == 0)
{
if(JFSUmaVez[playerid] == true) return SendClientMessage(playerid, -1, "Vocк ja pegou o colete !!");
SetPlayerHealth(playerid, 100.0);
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s comprou {FF00FF}vida {FF0000}( /health )", pname);
SendClientMessageToAll(0xFFFFAE96, string);
JFSUmaVez[playerid] = true;
GivePlayerMoney(playerid, -100);
return true;
}
//Topo do seu gm
new ccolete[MAX_PLAYERS];
//OnPlayerConnect
ccolete[playerid] = 0;
//OnPlayerDeath
ccolete[playerid] = 0;
//Comando
if(strcmp(cmdtext, "/colete", true) == 0)
{
if(ccolete[playerid] == 1){SendClientMessage(playerid, 0xFF6F28AA, "{FF0000}[ERRO]: {FFFFFF}Vocк ja usou colete");return 1;}
SetPlayerArmour(playerid, 100.0);
ccolete[playerid] = 1;
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s comprou {FF00FF}colete {FF0000}( /Colete )", pname);
SendClientMessageToAll(0xFFFFAE96, string);
GivePlayerMoney(playerid, -100);
return true;
}
e o colete vey mais vlw reply no gleisson e no jonhatan '-' sei la como escreve
|
//Topo do seu gm
new ccolete[MAX_PLAYERS];
//OnPlayerConnect
ccolete[playerid] = 0;
//OnPlayerDeath
ccolete[playerid] = 0;
//Comando
if(strcmp(cmdtext, "/colete", true) == 0)
{
if(ccolete[playerid] == 1){SendClientMessage(playerid, 0xFF6F28AA, "{FF0000}[ERRO]: {FFFFFF}Vocк ja usou colete");return 1;}
SetPlayerArmour(playerid, 100.0);
ccolete[playerid] = 1;
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s comprou {FF00FF}colete {FF0000}( /Colete )", pname);
SendClientMessageToAll(0xFFFFAE96, string);
GivePlayerMoney(playerid, -100);
return true;
}
//Topo do seu gm
new cvida[MAX_PLAYERS];
//OnPlayerConnect
cvida[playerid] = 0;
//OnPlayerDeath
cvida[playerid] = 0;
//Comando
if(!strcmp(cmdtext, "/vida", true))
{
if(GetPlayerMoney(playerid) >= 1000)
{
if(cvida[playerid] == 1){SendClientMessage(playerid, 0xFF6F28AA, "Vocк ja usou vida");return 1;}
GivePlayerMoney(playerid, -1000);
cvida[playerid] = 1;
new var0[265];
new var1[256];
GetPlayerName(playerid, var1, 30);
format(var0, 265, "%s Comprou vida! Custam $1000 {FFFF00}( /Vida )", var1);
SendClientMessageToAll(0x00FF00FF, var0);
SetPlayerHealth(playerid, 100.0);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
}
else
{
GameTextForPlayer(playerid, "~n~~r~TA DURO PLAYBOY !!", 3000, 3);
PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
}
return 1;
}
new ccolete
Cria uma variavel (acho que й o nome uashuash) para usarmos no comando do colete
Na public OnPlayerConnect usaremos a variavel ccolete[playerid] = 0; Informando que quando o player conectar ao servidor ele podera comprar colete, com a funзгo 0, com a funзгo 1, ele nao podera, altere ao seu gosto.
Na public OnPlayerDeath usaremos a variavel ccolete[playerid] = 0; Mesma coisa que na public OnPlayerConnect
Na public OnPlayerCommandText, dentro do comando /Colete usaremos isto:
if(ccolete[playerid] == 1){SendClientMessage(playerid, 0xFF6F28AA, "{FF0000}[ERRO]: {FFFFFF}Vocк ja usou colete");return 1;}
Se a variavel estiver 1, ele nao podera comprar colete denovo, sу apуs morrer como eu disse que poderia na public OnPlayerDeath, usado em servidor Mata-Mata
SetPlayerArmour(playerid, 100.0); Setara o colete do player para 100. Utilize a Wiki para saber mais: [url]http://wiki.sa-mp.com/wiki/SetPlayerArmour[/url]
SetPlayerHealth(playerid, 100.0); Setara a vida do player para 100. Utilize a Wiki para saber mais: [url]http://wiki.sa-mp.com/wiki/SetPlayerHealth[/url]
PlayerPlaySound. Executa um som do Gta ao jogador. Wiki: [url]http://wiki.sa-mp.com/wiki/PlayerPlaySound[/url]
GetPlayerMoney. Geta/Pega a grana/dinheiro do player. Wiki: [url]http://wiki.sa-mp.com/wiki/GetPlayerMoney[/url]
Creio que seja isso, o resto nao preciso explicar pois sao quase as mesmas funзхes.