[Ajuda] Comando com /aceitar
#1

Eae glr, estou com dъvida para criar um comando, alguйm pode me ajudar? Queria que fosse assim, por exemplo /reparo [id] [valor] ai a pessoa pra quem o mecвnico ofereceu reparo teria que dar /aceitar pro dinheiro ir para o mecвnico.
Reply
#2

PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
new IDMECANICO[MAX_PLAYERS];
CMD:reparo(playerid,params[])
{
        new 
IDValor;
        if(
sscanf(params,"dd",IDValor)) return SendClientMessage(playerid0xC4C4C4FF"Use /reparo [id] [valor]");
        if(
IsPlayerConnected(ID))
        {
            
IDMECANICO[ID] = playerid;
            new 
name[MAX_PLAYER_NAME], string[64+MAX_PLAYER_NAME];
            
GetPlayerName(playeridnamesizeof(name));
            
format(stringsizeof(string), "O mecanico %s estб lhe oferencedo seu servico por R$:%i Use /aceitar ou /recusar"name,Valor);
            
SendClientMessage(ID,0xC4C4C4FFstring);
        }
        else
        {
        
SendClientMessage(playerid0xC4C4C4FF"O player nгo estб conectado!");}
        return 
1;
}
CMD:aceitar(playerid,params[])
{
        if( 
IDMECANICO[playerid] == 1001)
        {
            
SendClientMessage(playerid,0xC4C4C4FF"Vocк jб aceitou o convite!");
        }
        else
        {
            new 
name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME],Float:x,Float:y,Float:z;
            
GetPlayerName(playeridnamesizeof(name));
            
format(stringsizeof(string), "%s Aceitou seus servicos!"name);
            
SendClientMessage(IDMECANICO[playerid],0xC4C4C4FFstring);
            
GetPlayerPos(playerid,x,y,z);
            
SetPlayerCheckpoint(IDMECANICO[playerid], x,y,z3.0);
            
IDMECANICO[playerid] = 1001;
        }
        return 
1;
}
CMD:recusar(playerid,params[])
{
        new 
name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
        
format(stringsizeof(string), "%s Recusou seus servicos!"name);
        
SendClientMessage(IDMECANICO[playerid],0xC4C4C4FFstring);
        
IDMECANICO[playerid] = 1001;
        return 
1;

nгo deu pra testar :/
Reply
#3

pawn Код:
IDMECANICO[ID] = playerid;
IDMECANICO[playerid] = 1001;


@edit
Estou meio enferrujado em relaзгo a programaзгo, mas й algo parecido com isso.

PHP код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
new reparo[MAX_PLAYERS] = 0;
new 
bool:Solic[MAX_PLAYERS];
new 
quantia[MAX_PLAYERS];
CMD:reparar(playeridparams[])
{
    new 
playervalor;
    if(
sscanf(params"dd"playervalor)) return SendClientMessage(playerid, -1"Use: /reparar [id] [valor]");
    if(!
IsPlayerConnected(player)) return SendClientMessage(playerid, -1"Jogador nгo estб conectado");
    if(
EmpregoJogador[playerid] != 1) return SendClientMessage(playerid, -1"Vocк precisa ser mecвnico");
    
quantia[player] = valor;
    
Solic[player] = true;
    
    
//Aн vocк termina
    
    
return 1;
}
CMD:aceitar(playeridparams[])
{
    if(
Solic[playerid] == true)
    {
        
GivePlayerMoney(playerid, -quantia[player];
        
//Ele aceita e paga
    
}
    else return 
SendClientMessage(playerid, -1"Ninguйm te ofereceu um reparo");
    
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)