Trailer command
#1

pawn Код:
CMD:tow(playerid, params[])
    {
    if(IsPlayerInAnyVehicle(playerid))
        {
        new vehicleid = GetPlayerVehicleID(playerid);
        new string[128];
        if(isnull(params))
            {
            SendClientMessage(playerid, -1, "Usage: /tow [VehicleID]");
            SendClientMessage(playerid, -1, "Hint: Use /dl to find the ID of the vehicle to tow");
            }
        if(!strcmp(params, "%s", false))
            {
            format(string, 3, "%s", params);
            if(GetVehicleModel(vehicleid) == 525 & 554 & 489 & 490)
                {
                AttachTrailerToVehicle(vehicleid, string);
                return 1;
                }
            }
        }
    return 0;
    }
It shows an error for the line "AttachTrailerToVehicle" How do I show the string in the function?
Reply
#2

Anyone know?
Reply
#3

Post the error.
Reply
#4

Can't use a string in AttachTrailerToVehicle, Need to use an integer. Try using sscanf to convert the params into an integer. Be much easier.
Код:
new id;
sscanf(params, "i", id);
AttachTrailerToVehicle(id, vehicleid);
Reply
#5

Thanks, it worked, any idea on how to use IsPlayerInRangeOfPoint for the vehicle to be towed??
Reply
#6

Код:
new Float:x, Float:y, Float:z;
GetVehPos(id, x, y, z); // id = trailer id
If(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
{
	//Let's code stuff
	//end of code
}
Reply
#7

oh, okay..thanks guys! +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)