[Ajuda] Sistema coins!
#5

Fiz uma base pra vocк, й bem simples, tente entender o cуdigo...

PHP код:
enum pInfo{
    
pCoins[MAX_PLAYERS],
}
new 
Player[MAX_PLAYERS][pInfo];
//=================================================
CMD:adicionarcoins(playeridparams[]) //ADICIONA coins
{
    new 
idcoinsstring[60];
    if(
sscanf(params"ui"idcoins)) return SendClientMessage(playerid, -1"Use: /adicionarcoins [id] [coins]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid, -1"Player desconectado.");
                      
//( + ) juntando com o que o cara tem ( = )
    
Player[id][pCoins] += coins;
    
format(stringsizeof(string), "%s lhe deu +%d coins"Nick(playerid), coins);
    
SendClientMessage(id, -1string);
    
format(stringsizeof(string), "Vocк deu +%d coins para o %s"coinsNick(id));
    
SendClientMessage(playerid, -1string);
    return 
1;
}
CMD:setcoins(playeridparams[]) //SETA coins
{
    new 
idcoinsstring[60];
    if(
sscanf(params"ui"idcoins)) return SendClientMessage(playerid, -1"Use: /setarcoins [id] [coins]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid, -1"Player desconectado.");
    
Player[id][pCoins] = coins;
    
format(stringsizeof(string), "%s lhe deu %d coins"Nick(playerid), Player[id][pCoins]);
    
SendClientMessage(id, -1string);
    
format(stringsizeof(string), "Vocк deu %d coins para o %s"Player[id][pCoins], Nick(id));
    
SendClientMessage(playerid, -1string);
    return 
1;
}
CMD:coins(playerid
{
    new 
string[40];
    
format(stringsizeof(string), "Vocк tem: %d coins!"Player[playerid][pCoins]);
    
SendClientMessage(playerid, -1string);
    return 
1;
}
CMD:comprarvip(playerid//Exemplo de como usar
{                      //Se for Maior ( > ) ou igual ( = )
    
if(Player[playerid][pCoins] >= 1000){
        
SendClientMessage(playerid, -1"Vocк tem 1000 coins entгo agora й um jogador VIP :)");
        
Player[playerid][pCoins] -= 1000;
        
//.....
    
}else{
        
SendClientMessage(playerid, -1"Vocк nгo tem 1.000 coins.");
    }
    return 
1;

Pode ser ъtil para vocк: https://sampforum.blast.hk/showthread.php?tid=235924
Reply


Messages In This Thread
Sistema coins! - by ScripterIniciantePT - 28.10.2017, 19:31
Re: Sistema coins! - by FStralioti - 28.10.2017, 19:34
Re: Sistema coins! - by ScripterIniciantePT - 28.10.2017, 19:36
Re: Sistema coins! - by ScripterIniciantePT - 28.10.2017, 19:58
Re: Sistema coins! - by UserUnk0wn - 28.10.2017, 20:27
Re: Sistema coins! - by ScripterIniciantePT - 28.10.2017, 21:42
Re: Sistema coins! - by ScripterIniciantePT - 28.10.2017, 21:44
Re: Sistema coins! - by UserUnk0wn - 29.10.2017, 16:16
Re: Sistema coins! - by IlanZ - 29.10.2017, 17:38
Re: Sistema coins! - by RodrigoMSR - 29.10.2017, 19:15

Forum Jump:


Users browsing this thread: 2 Guest(s)