SA-MP Forums Archive
Commands Change - 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: Commands Change (/showthread.php?tid=410933)



Commands Change - UnAngel - 27.01.2013

Hello i need to change this commands to zcmd but i dont know how
please change this !!




Quote:

else if(!strcmp(x_v, "buylock",true))
{
if(IsPlayerInAnyVehicle(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /buylock [number(1-5)]");
return 1;
}
new lock;
lock = strval(tmp);
new vehicle = GetPlayerVehicleID(playerid);
if(lock < 1 || lock > 5) { SendClientMessage(playerid, COLOR_LIGHTRED, "Lock level can't be below 1 or above 5 !"); return 1; }
if(VehicleInfo[vehicle][vLockBuyed] >= lock) { format(string, sizeof(string), "You already own a lock level %d or more !", lock); SendClientMessage(playerid, COLOR_LIGHTRED, string); return 1; }
new lockcost = lock*5000;
if(VehicleInfo[vehicle][vOwned] == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle");
return 1;
}
GetPlayerName(playerid, playername, sizeof(playername));
if(strcmp(playername, VehicleInfo[vehicle][vOwner], true) == 0)
{
if(GetPlayerMoney(playerid) >= lockcost)
{
format(string, sizeof(string), "You have succefully bought a lock level %d.", lock);
SendClientMessage(playerid, COLOR_GREEN, string);
GivePlayerMoney(playerid, -lockcost);
VehicleInfo[vehicle][vLockBuyed] = lock;
SaveVehicles(playerid, vehicle);
return 1;
}
else
{
format(string, sizeof(string), "You don't have $%d with you to buy an alarm level %d", lockcost, lock);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in a vehicle !");
return 1;
}
}




Re: Commands Change - Roach_ - 27.01.2013

ZCMD + SSCANF:
pawn Код:
CMD:buylock(playerid, params[])
{
    new lock;
    if(sscanf(params, "i", lock)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /buylock [number(1-5)]");
    new vehicle = GetPlayerVehicleID(playerid);
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not in a vehicle !");
    if(lock < 1 || lock > 5) return SendClientMessage(playerid, COLOR_LIGHTRED, "Lock level can't be below 1 or above 5 !");
    if(VehicleInfo[vehicle][vLockBuyed] >= lock) { format(string, sizeof(string), "You already own a lock level %d or more !", lock); SendClientMessage(playerid, COLOR_LIGHTRED, string); return 0; }
    new lockcost = lock*5000;
    if(VehicleInfo[vehicle][vOwned] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle");
    GetPlayerName(playerid, playername, sizeof(playername));
    if(strcmp(playername, VehicleInfo[vehicle][vOwner], true)) return SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own this vehicle !");
    if(GetPlayerMoney(playerid) >= lockcost)
    {
        format(string, sizeof(string), "You have succefully bought a lock level %d.", lock);
        SendClientMessage(playerid, COLOR_GREEN, string);
        GivePlayerMoney(playerid, -lockcost);
        VehicleInfo[vehicle][vLockBuyed] = lock;
        SaveVehicles(playerid, vehicle);
        return 1;
    }
    else
    {
        format(string, sizeof(string), "You don't have $%d with you to buy an alarm level %d", lockcost, lock);
        SendClientMessage(playerid, COLOR_LIGHTRED, string);
        return 0;
    }
    return 1;
}



Re: Commands Change - bathushan - 27.01.2013

Lol i just want to ask this... Please can you Make this to zcmd pls. Please!!!!

PHP код:
if (strcmp("/cop"cmdtexttrue10) == 0)
{
    
SendClientMessage(playeridsoldiercolor"You are now on the cop team");
    
pTeam[playerid] = team_cop;    
   
SetPlayerSkin(playerid281);
    
GivePlayerWeapon(playerid1710);
    
SetPlayerPos(playerid309206018);
    return 
1;

If posible Explain me?
Please!


AW: Commands Change - Blackazur - 27.01.2013

Код:
COMMAND:cop(playerid,params[])
{    SendClientMessage(playerid, soldiercolor, "You are now on the cop team");    pTeam[playerid] = team_cop;    SetPlayerSkin(playerid, 281);    GivePlayerWeapon(playerid, 17, 10);    SetPlayerPos(playerid, 309, 2060, 18);    return 1;}



Re: Commands Change - Roach_ - 27.01.2013

Quote:
Originally Posted by bathushan
Посмотреть сообщение
Lol i just want to ask this... Please can you Make this to zcmd pls. Please!!!!

PHP код:
if (strcmp("/cop"cmdtexttrue10) == 0)
{
    
SendClientMessage(playeridsoldiercolor"You are now on the cop team");
    
pTeam[playerid] = team_cop;    
   
SetPlayerSkin(playerid281);
    
GivePlayerWeapon(playerid1710);
    
SetPlayerPos(playerid309206018);
    return 
1;

If posible Explain me?
Please!
There's nothing to explain:
pawn Код:
CMD:cop(playerid)
{
    SendClientMessage(playerid, soldiercolor, "You are now on the cop team");
    pTeam[playerid] = team_cop;
    SetPlayerSkin(playerid, 281);
    GivePlayerWeapon(playerid, 17, 10);
    SetPlayerPos(playerid, 309, 2060, 18);
    return 1;
}
I've only changed the Command Processor, nothing else, the command is too simple to change anything else..


Re: AW: Commands Change - bathushan - 27.01.2013

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
Код:
COMMAND:cop(playerid,params[])
{    SendClientMessage(playerid, soldiercolor, "You are now on the cop team");    pTeam[playerid] = team_cop;    SetPlayerSkin(playerid, 281);    GivePlayerWeapon(playerid, 17, 10);    SetPlayerPos(playerid, 309, 2060, 18);    return 1;}
Also to Change to Zcmd we have to change only this line ?
PHP код:
if (strcmp("/cop"cmdtexttrue10) == 0
To
PHP код:
COMMAND:cop(playerid,params[]) 
Right?

Edit
-------

Thankyou Very Much!!!


Re: Commands Change - Roach_ - 27.01.2013

You don't need parameters in this Command, 'cause you don't have parameters..

pawn Код:
if (strcmp("/cop", cmdtext, true, 10) == 0)
To

pawn Код:
CMD:cop(playerid)
If you have parameters, you add 'params[]' too..


AW: Re: AW: Commands Change - Blackazur - 27.01.2013

Quote:
Originally Posted by bathushan
Посмотреть сообщение
Also to Change to Zcmd we have to change only this line ?
PHP код:
if (strcmp("/cop"cmdtexttrue10) == 0
To
PHP код:
COMMAND:cop(playerid,params[]) 
Right?

Edit
-------

Thankyou Very Much!!!
Yep, but when the Cmd dont have params you can simple use
Код:
COMMAND:cop
like Roach_ said.


Re: Commands Change - Roach_ - 27.01.2013

And (playerid)
Or if you need a GMX Command, you can use this:
pawn Код:
CMD:gmx() return SendRconCommand("gmx");
So no playerid, and params needed..


Re: Commands Change - UnAngel - 27.01.2013

Someone can make me all this
thanks so mach for helpers
Roach thanks dude

http://pastebin.com/h2PgZ9Nr

send me in privete