CallRemoteFunction - What's wrong with this?
#1

I'm using my gamemode with a /vehiclespray command to respray the vehicle

The vehicle script is a filterscript and I'm trying to call a remote function from it so it saves the new vehicle color

Here's the GAMEMODE command and calling the remote function

pawn Код:
if (strcmp(cmd, "/vehiclespray", true) == 0 )
        {
            new vehicleseat = GetPlayerVehicleSeat(playerid);
            if(PlayerInfo[playerid][pSprayCan] < 1)
            {
                SendClientMessage(playerid, COLOR_RED, "You don't have any Spray Cans!");
                return 1;
            }
            if(!IsPlayerInAnyVehicle(playerid))
            {
                SendClientMessage(playerid, COLOR_RED, "You must be in a vehicle to do that!");
                return 1;
            }
            if(vehicleseat != 0)
            {
                SendClientMessage(playerid, COLOR_RED, "You must be in the drivers seat to do that!");
                return 1;
            }
            if(vehicleseat == 0)
            {
                new color1, color2;
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_RED, "USAGE: /vehiclespray [Color1] [Color2]");
                    return 1;
                }
                color1 = strval(tmp);
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_RED, "USAGE: /vehiclespray [Color1] [Color2]");
                    return 1;
                }
                color2 = strval(tmp);
                ChangeVehicleColor(GetPlayerVehicleID(playerid), color1, color2);
                CallRemoteFunction("OnVehicleRespray" "playerid", "vehicleid", "color1", "color2");
                return 1;
            }
        }
Here's the function from the FILTERSCRIPT

pawn Код:
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    new id = GetVehicleID(vehicleid);
    if(IsValidVehicle(id))
    {
        VehicleColor[id][0] = color1;
        VehicleColor[id][1] = color2;
        SaveVehicle(id);
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)