SA-MP Forums Archive
Command Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command Help (/showthread.php?tid=342579)



Command Help - Evation - 14.05.2012

Can anyone help me make two commands?

a
/goldrims - makes the car your in have goldrims perm until changed.
/refund - gives player 5m cash, 100k mats 500 pot and crack and silver vip.

im using
zcmd


Re: Command Help - iGetty - 14.05.2012

What are your player variables for VIP, Cash, Pot and materials?


Re: Command Help - iRage - 14.05.2012

Can you provide the variables you use to store player's vehicle modifications, money, materials, pot, crack and VIP level?


Re: Command Help - Evation - 14.05.2012

GivePlayerCash
PlayerInfo[giveplayerid][pDonateRank]
PlayerInfo[giveplayerid][pMats]
PlayerInfo[giveplayerid][pPot]
PlayerInfo[giveplayerid][pCrack]

i believe there correct.

edit; not sure about the vehicle thing.

edit again; can you do levels too?


Re: Command Help - iRage - 14.05.2012

I suppose you're using sscanf2 too, so here we go.


Command: /refund
Note: Replace /* level */ with the VIP level of silver.
pawn Код:
CMD:refund(playerid, params[])
{
    new playerb, string[128], pname[MAX_PLAYER_NAME];
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /refund [playerid]");
    if(!IsPlayerConnected(playerb) || playerb == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: Invalid player id.");
    // Giving the refund
    GivePlayerCash(playerb, 5000000);
    PlayerInfo[playerb][pDonateRank] = /* level */;
    PlayerInfo[playerb][pMats] = 100000;
    PlayerInfo[playerb][pPot]  = 500;
    PlayerInfo[playerb][pCrack] = 500;
    // Getting name of the player you refunded and sending you a confirmation message
    GetPlayerName(playerb, pname, sizeof(pname);
    format(string, sizeof(string), "You have refunded %s.", pname);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    // Getting your name and sending the player you refunded a confirmation message
    GetPlayerName(playerid, pname, sizeof(pname);
    format(string, sizeof(string), "%s has refunded you.", pname);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}
As for the vehicle, until you get the variable that saves modifications, use this:

pawn Код:
CMD:goldrims(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not driving a vehicle.");
    AddVehicleComponent(GetPlayerVehicleID(playerid),1080);
    SendClientMessage(playerid, 0xFFFFFFFF, "You have added Gold Rims to your vehicle.");
    return 1;
}



Re: Command Help - Evation - 14.05.2012

iRage, how could i find the var?


Re: Command Help - iRage - 14.05.2012

Does your script save vehicle modifications?


Re: Command Help - Evation - 14.05.2012

yes i suppose.


Re: Command Help - iRage - 14.05.2012

You should try modding your vehicle and respawning it somehow, by parking it or restarting the server or relogging if the vehicle disappears when its owner logs out or any other method.

Tell me if it respawns with its modifications or not.


Re: Command Help - Evation - 14.05.2012

errors;
Код:
C:\Users\Nathan\Desktop\Evation RP\gamemodes\ERP.pwn(54877) : error 001: expected token: ",", but found ";"
C:\Users\Nathan\Desktop\Evation RP\gamemodes\ERP.pwn(54881) : error 001: expected token: ",", but found ";"
lines
Код:
	GetPlayerName(playerb, pname, sizeof(pname);
	GetPlayerName(playerid, pname, sizeof(pname);