ChangeVehicleColor - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ChangeVehicleColor (
/showthread.php?tid=247950)
ChangeVehicleColor -
McCarthy - 11.04.2011
Okay, so I want to make a command that will change the color of a vehicle into the one I want.
Basicly if I want black /paintcar 0 0 , how can I do it?
Heres my current code:
pawn Код:
if(strcmp("/paintcar",cmdtext, true) == 0)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerConnected(playerid))
{
ChangeVehicleColor (vehicleid, -1, -1);
return 1;
}
return 1;
}
Re: ChangeVehicleColor -
HyperZ - 11.04.2011
You want this?
Use
Sscanf2 and
Zcmd.
pawn Код:
CMD:paintcar( playerid, params[ ] )
{
new string[128], colour1, colour2;
if(sscanf(params, "dd", colour1, colour2)) return SendClientMessage(playerid, -1, "USAGE: /carcolour [Colour1] [Colour2]");
if(IsPlayerInAnyVehicle(playerid))
{
format(string, sizeof(string), "You have Changed your vehicle colour to '%d,%d'", colour1, colour2);
SendClientMessage(playerid, -1,string);
ChangeVehicleColor(GetPlayerVehicleID(playerid), colour1, colour2);
}
else return SendClientMessage(playerid, -1,"ERROR: You are not in a vehicle");
return 1;
}
Re: ChangeVehicleColor -
McCarthy - 11.04.2011
Compiler crashes
Re: ChangeVehicleColor -
HyperZ - 11.04.2011
Quote:
Originally Posted by McCarthy
Compiler crashes
|
Not for me.
Re: ChangeVehicleColor -
McCarthy - 11.04.2011
Quote:
Originally Posted by Clive
Not for me.
|
Strange.. :S
Re: ChangeVehicleColor -
antonio112 - 11.04.2011
Are you sure you're using the right includes?
Re: ChangeVehicleColor -
xir - 11.04.2011
Edit: nvm
Re: ChangeVehicleColor -
McCarthy - 11.04.2011
Quote:
Originally Posted by antonio112
Are you sure you're using the right includes?
|
Should be
Re: ChangeVehicleColor -
[OC]Zero - 12.04.2011
You want something like this?
pawn Код:
CMD:carcol(playerid, params[])
{
new color1,color2;
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"not in any vehicle");
if(sscanf(params,"dd",color1, color2)) return SendClientMessage(playerid,-1,"/carcol [0-252] [0-252]");
ChangeVehicleColor(GetPlayerVehicleID(playerid),color1,color2);
return 1;
}
Hope that worked had to write that on the fly busy O_O
easy.
Re: ChangeVehicleColor -
McCarthy - 14.04.2011
D:\SAMP\gamemodes\MMM.pwn(2) : fatal error 100: cannot read from file: "sscanf"
I have sscanf2 installed.