ChangeVehicleColor
#1

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;

    }
Reply
#2

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;
}
Reply
#3

Compiler crashes
Reply
#4

Quote:
Originally Posted by McCarthy
Посмотреть сообщение
Compiler crashes
Not for me.
Reply
#5

Quote:
Originally Posted by Clive
Посмотреть сообщение
Not for me.
Strange.. :S
Reply
#6

Are you sure you're using the right includes?
Reply
#7

Edit: nvm
Reply
#8

Quote:
Originally Posted by antonio112
Посмотреть сообщение
Are you sure you're using the right includes?
Should be
Reply
#9

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.
Reply
#10

D:\SAMP\gamemodes\MMM.pwn(2) : fatal error 100: cannot read from file: "sscanf"

I have sscanf2 installed.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)