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



/spraycar - Jimmy0wns - 28.12.2012

Hey, i made a new script for /spraycar but it only gives your car black colours, even if you do /spraycar 6 13

pawn Код:
dcmd_spraycar(playerid, params[])
{
   if(GetPlayerState(playerid) != 2) return SendClientMessage(playerid, 0xFF0000FF, "You are not driving in a vehicle.");
   new clr,clr2;
   if(sscanf(params, "iI(-1)", clr, clr2))
   {
    return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /spraycar [color1] <color2>");
   }
   if(clr2 == -1) clr2 = clr;
   new szSuccess[44];
   format(szSuccess, sizeof(szSuccess), "Vehicle colors changed to: {FFFFFF}%i and %i.", clr, clr2);
   SendClientMessage(playerid, 0x00FF00FF, szSuccess);
   ChangeVehicleColor(GetPlayerVehicleID(playerid), clr, clr2);
   return 1;
}



Re : /spraycar - [HRD]Mar1 - 28.12.2012

pawn Код:
new colour1, colour2;
if(!strlen(tmp2)) colour1 = random(126);
else colour1 = strval(tmp2);
if(!strlen(tmp3)) colour2 = random(126);
else colour2 = strval(tmp3);

ChangeVehicleColor(GetPlayerVehicleID(playerid), colour1, colour2);



Re: Re : /spraycar - Jimmy0wns - 28.12.2012

Quote:
Originally Posted by [HRD]Mar1
Посмотреть сообщение
pawn Код:
new colour1, colour2;
if(!strlen(tmp2)) colour1 = random(126);
else colour1 = strval(tmp2);
if(!strlen(tmp3)) colour2 = random(126);
else colour2 = strval(tmp3);

ChangeVehicleColor(GetPlayerVehicleID(playerid), colour1, colour2);
So i have this now:
pawn Код:
dcmd_spraycar(playerid, params[])
        {
            if(GetPlayerState(playerid) != 2) return SendClientMessage(playerid, 0xFF0000FF, "You are not driving in a vehicle.");
            new clr,clr2;
            if(sscanf(params, "iI(-1)", clr, clr2))
            {
             return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /spraycar [color1] <color2>");
            }
            new colour1, colour2;
            if(!strlen(tmp2)) colour1 = random(126);
            else colour1 = strval(tmp2);
            if(!strlen(tmp3)) colour2 = random(126);
            else colour2 = strval(tmp3);
            ChangeVehicleColor(GetPlayerVehicleID(playerid), colour1, colour2);
            return 1;
        }
But it gives me the following errors:
Код:
C:\Users\r530\Desktop\C&R\gamemodes\SFCRRPG.pwn(3305) : error 017: undefined symbol "dcmd_spraycar"
*****(3309) : error 017: undefined symbol "params"
*****(3314) : error 017: undefined symbol "tmp2"
*****(3315) : error 017: undefined symbol "tmp2"
*****(3316) : error 017: undefined symbol "tmp3"
*****(3317) : error 017: undefined symbol "tmp3"
*****(3308) : warning 203: symbol is never used: "clr2"
*****(3308) : warning 203: symbol is never used: "clr"
*****(3308 -- 3323) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Errors.



Re : /spraycar - [HRD]Mar1 - 28.12.2012

pawn Код:
dcmd_spraycar(playerid, params[])
        {
            if(GetPlayerState(playerid) != 2) return SendClientMessage(playerid, 0xFF0000FF, "You are not driving in a vehicle.");
            new colour1,colour2;
            new tmp2[256]; tmp2 = strtok(params,Index);
            new tmp3[256]; tmp3 = strtok(params,Index);
            if(sscanf(params, "iI(-1)", colour1, colour2))
            {
             return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /spraycar [color1] <color2>");
            }
            new colour1, colour2;
            if(!strlen(tmp2)) colour1 = random(126);
            else colour1 = strval(tmp2);
            if(!strlen(tmp3)) colour2 = random(126);
            else colour2 = strval(tmp3);
            ChangeVehicleColor(GetPlayerVehicleID(playerid), colour1, colour2);
            return 1;
        }
[PAWN]
add this in your OnPlayerCommandText
pawn Код:
dcmd(spraycar,9,cmdtext);