SA-MP Forums Archive
[Tool/Web/Other] Tires Command - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [Tool/Web/Other] Tires Command (/showthread.php?tid=252363)



Tires Command - Mister. M - 01.05.2011

Hello guys,

I don't know if this has been released yet, but i didn't found it so here it is.

pawn Код:
dcmd_ctires(playerid,params[])
{
    #pragma unused params
    new tires;
    if(sscanf(params, "i", tires)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ctires [#tires]");
    if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,COLOR_GREY,"* You are not an administrator or not logged in as RCON!");;
   

        if(!IsPlayerInAnyVehicle(playerid)){ return SendClientMessage(playerid,COLOR_RED,"* You're not in a vehicle."); }

    if(tires < 0 || tires > 15){ return SendClientMessage(playerid,COLOR_RED,"Between 0 and 14"); }

    if(tires == 1) AddVehicleComponent(GetPlayerVehicleID(playerid),1073);
    if(tires == 2) AddVehicleComponent(GetPlayerVehicleID(playerid),1074);
    if(tires == 3) AddVehicleComponent(GetPlayerVehicleID(playerid),1075);
    if(tires == 4) AddVehicleComponent(GetPlayerVehicleID(playerid),1076);
    if(tires == 5) AddVehicleComponent(GetPlayerVehicleID(playerid),1077);
    if(tires == 6) AddVehicleComponent(GetPlayerVehicleID(playerid),1078);
    if(tires == 7) AddVehicleComponent(GetPlayerVehicleID(playerid),1079);
    if(tires == 8) AddVehicleComponent(GetPlayerVehicleID(playerid),1080);
    if(tires == 9) AddVehicleComponent(GetPlayerVehicleID(playerid),1081);
    if(tires == 10) AddVehicleComponent(GetPlayerVehicleID(playerid),1082);
    if(tires == 11) AddVehicleComponent(GetPlayerVehicleID(playerid),1083);
    if(tires == 12) AddVehicleComponent(GetPlayerVehicleID(playerid),1084);
    if(tires == 13) AddVehicleComponent(GetPlayerVehicleID(playerid),1085);

    new string[128];
    format(string, sizeof(string), "* Your car tires have been changed!");

    SendClientMessage(playerid,COLOR_ORANGE,string);
    return true;
}

How to install?
Go to your Pawno,, open your gamemod and add this on top of
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[]){
pawn Код:
dcmd(ctires,6,cmdtext);
Hope you guys like it.


Re: Tires Command - Infamous - 01.05.2011

Good job mate, not everyone can script so this could be very useful to some people.


Re: Tires Command - Mister. M - 01.05.2011

Instead of everyone says: Wrong Section, you could give me the right section..

~~


Re: Tires Command - pischel - 01.05.2011

Try to use Else If or switch... It's more better than if if if milion times.


Re: Tires Command - Zh3r0 - 01.05.2011

Instead of
pawn Код:
if(tires == 1) AddVehicleComponent(GetPlayerVehicleID(playerid),1073);
    if(tires == 2) AddVehicleComponent(GetPlayerVehicleID(playerid),1074);
    if(tires == 3) AddVehicleComponent(GetPlayerVehicleID(playerid),1075);
    if(tires == 4) AddVehicleComponent(GetPlayerVehicleID(playerid),1076);
    if(tires == 5) AddVehicleComponent(GetPlayerVehicleID(playerid),1077);
    if(tires == 6) AddVehicleComponent(GetPlayerVehicleID(playerid),1078);
    if(tires == 7) AddVehicleComponent(GetPlayerVehicleID(playerid),1079);
    if(tires == 8) AddVehicleComponent(GetPlayerVehicleID(playerid),1080);
    if(tires == 9) AddVehicleComponent(GetPlayerVehicleID(playerid),1081);
    if(tires == 10) AddVehicleComponent(GetPlayerVehicleID(playerid),1082);
    if(tires == 11) AddVehicleComponent(GetPlayerVehicleID(playerid),1083);
    if(tires == 12) AddVehicleComponent(GetPlayerVehicleID(playerid),1084);
    if(tires == 13) AddVehicleComponent(GetPlayerVehicleID(playerid),1085);
All that crap

You could simply do:
pawn Код:
AddVehicleComponent(GetPlayerVehicleID(playerid),1073 + tires);



Re: Tires Command - xxmitsu - 01.05.2011

+
don't use sscanf to read only one integer parameter use strval.
also,
Код:
    new string[128];
    format(string, sizeof(string), "* Your car tires have been changed!");

    SendClientMessage(playerid,COLOR_ORANGE,string);
could change into this:
Код:
    SendClientMessage(playerid,COLOR_ORANGE,"* Your car tires have been changed!");
also
Код:
 if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,COLOR_GREY,"* You are not an administrator or not logged in as RCON!");;
I don't think that IsPlayerConnected will return if you have RCON-administrative rights or not.


Re: Tires Command - Zh3r0 - 01.05.2011

Quote:
Originally Posted by xxmitsu
Посмотреть сообщение
+
don't use sscanf to read only one integer parameter use strval.
also,
Код:
    new string[128];
    format(string, sizeof(string), "* Your car tires have been changed!");

    SendClientMessage(playerid,COLOR_ORANGE,string);
could change into this:
Код:
    SendClientMessage(playerid,COLOR_ORANGE,"* Your car tires have been changed!");
also
Код:
 if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid,COLOR_GREY,"* You are not an administrator or not logged in as RCON!");;
I don't think that IsPlayerConnected will return if you have RCON-administrative rights or not.
I never understand people that use IsPlayerConnected to check if they are connected, that' UNLOGICAL!


Re: Tires Command - xxmitsu - 01.05.2011

It was a bug in the "very old" samp server version. But that was corrected.

Also, It's more than obvoius that the "connected player" is the one executing the command, so it shouldn't be checked if it's connected or not.

I guess IsPlayerAdmin is what he wanted instead of IsPlayerConnected.