some help with 2 commands.
#1

hi there, I have a problem with my /pay command and with the /createcar .

The problem with the /pay is that It doesn't give the money to the playerid, on the action it says that it gives the money to urself and the money doesn't +/-

PHP код:
CMD:pay(playeridparams[])
{
    new 
idamountpName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME], string[126];
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(idpName2sizeof(pName2));
    if(!
sscanf(params"ud"idamount))
    {
        if(
playerid == playerid)
        {
            if(
IsPlayerConnected(id))
            {
                   if(
Player[playerid][Money] >= amount)
                   {
                      
Player[playerid][Money] -= amount;
                      
Player[id][Money] += amount;
                    
format(stringsizeof(string), "%s i-a dat lui %s $%d"pNamepName2amount);
                    
ProxDetector(30playeridstringcolor_purplecolor_purplecolor_purplecolor_purplecolor_purple);
                } else 
SendClientMessage(playeridcolor_grey"Nu ai destui bani !");
            } else 
SendClientMessage(playeridcolor_grey"Acest jucator nu este conectat !");
        } else 
SendClientMessage(playeridcolor_grey"Nu poti sa te platesti singur !");
    }
    else 
SendClientMessage(playeridcolor_grey"UTILIZARE:/pay <id> <suma>");
    return 
1;

And with the /createcar . How can I make it when the car is spawned to have its engine off ? I tried for a bit of time but it doesn't spawn the car .

PHP код:
CMD:createcar(playeridparams[])
{
    if(
IsPlayerInAnyVehicle(playerid))
    {
        if(
Player[playerid][Admin] >= 10)
        {
            new 
caridcolor1color2Float:pos[4];
              
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
            
GetPlayerFacingAngle(playeridpos[3]);
               
            if (!
sscanf(params"iii"caridcolor1color2))
            {
                 
CreateVehicle(caridpos[0], pos[1], pos[2], pos[3], color1color2, -1);
              }
            else 
SendClientMessage(playeridcolor_grey"UTILIZARE: /createcar <modelid> <color1> <color2>");
        }
        else 
SendClientMessage(playerid0xFF0000FF"Nu esti autorizat sa foloseste aceasta comanda.");
    }
    return 
1;

Reply
#2

Fixed commands:

Код:
CMD:pay(playerid, params[]) 
{ 
    new id, amount, pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME], string[126]; 

    GetPlayerName(playerid, pName, sizeof(pName)); 
    GetPlayerName(id, pName2, sizeof(pName2)); 

    if(!sscanf(params, "ud", id, amount)) 
    { 
        if(id != playerid) 
        { 
            if(IsPlayerConnected(id)) 
            { 
                   if(Player[playerid][Money] >= amount) 
                   { 
                      Player[playerid][Money] -= amount; 
                      Player[id][Money] += amount; 
					  SetPlayerMoney(playerid, Player[playerid][Money]);
					  SetPlayerMoney(id, Player[id][Moneyg);

                    format(string, sizeof(string), "%s i-a dat lui %s $%d", pName, pName2, amount); 
                    ProxDetector(30, playerid, string, color_purple, color_purple, color_purple, color_purple, color_purple); 
                } else SendClientMessage(playerid, color_grey, "Nu ai destui bani !"); 
            } else SendClientMessage(playerid, color_grey, "Acest jucator nu este conectat !"); 
        } else SendClientMessage(playerid, color_grey, "Nu poti sa te platesti singur !"); 
    } 
    else SendClientMessage(playerid, color_grey, "UTILIZARE:/pay <id> <suma>"); 
    return 1; 
}
Код:
CMD:createcar(playerid, params[]) 
{ 
    if(IsPlayerInAnyVehicle(playerid)) 
    { 
        if(Player[playerid][Admin] >= 10) 
        { 
            new carid, color1, color2, Float:pos[4]; 

              GetPlayerPos(playerid, pos[0], pos[1], pos[2]); 
            GetPlayerFacingAngle(playerid, pos[3]); 
                
            if (!sscanf(params, "iii", carid, color1, color2)) 
            { 
				 new idofspawnedcar; 
                 idofspawnedcar = CreateVehicle(carid, pos[0], pos[1], pos[2], pos[3], color1, color2, -1); 
				 new engine, lights, alarm, doors, bonnet, boot, objective;
				 GetVehicleParamsEx(idofspawnedcar, engine, lights, alarm, doors, bonnet, boot, objective);
				 SetVehicleParamsEx(idofspawnedcar, 0, lights, alarm, doors, bonnet, boot, objective);
            } 
            else SendClientMessage(playerid, color_grey, "UTILIZARE: /createcar <modelid> <color1> <color2>"); 
        } 
        else SendClientMessage(playerid, 0xFF0000FF, "Nu esti autorizat sa foloseste aceasta comanda."); 
    } 
    return 1; 
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)