SA-MP Forums Archive
Why isnt this working? - 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: Why isnt this working? (/showthread.php?tid=206912)



Why isnt this working? - Jack_Rocker - 04.01.2011

Thanks for helping me!
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(plate, 5, cmdtext);
    return 0;
}
public dcmd_plate(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)){
        SendClientMessage(playerid, 0x999999AA, "You are not in a vehicle");
        return 1;
    }else{
        SetVehicleNumberPlate(GetPlayerVehicleID(playerid), params);
    }
    return 1;
}
It still wont let me change the number plate


Re: Why isnt this working? - [L3th4l] - 04.01.2011

pawn Код:
public OnPlayerCommandText(....)



Re: Why isnt this working? - Jack_Rocker - 04.01.2011

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(....)
What?:S


Re: Why isnt this working? - DarrenReeder - 04.01.2011

It has to say "public OnPlayerCommandText" instead of just "OnPlayerCommandText"....


Re: Why isnt this working? - Vince - 04.01.2011

I don't know if anyone of you noticed, but OnPlayerCommandText IS public in his code ..
@OP: You need to respawn the vehicle for SetVehicleNumberPlate to work.


Re: Why isnt this working? - PowerPC603 - 04.01.2011

This is the code that I'm using and it works:
pawn Код:
dcmd_plate(playerid, params[])
{
    // Setup local variables
    new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective, Plate[32];

    // Get the player's vehicle
    vehicleid = GetPlayerVehicleID(playerid);

    if (vehicleid != 0)
    {
        if (sscanf(params, "s[32]", Plate)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/plate <NumberPlate>\"");
        else
        {
            // Set the numberplate
            SetVehicleNumberPlate(vehicleid, Plate);
            // Remove the player from the vehicle
            RemovePlayerFromVehicle(playerid);
            // Respawn the vehicle
            SetVehicleToRespawn(vehicleid);
            // Put the player back in the vehicle
            PutPlayerInVehicle(playerid, vehicleid, 0);
            // Turn on the engine and lights of the vehicle
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
        }
    }
    else
        SendClientMessage(playerid, 0x00FF00FF, "You must be inside a vehicle to change your numberplate");

    // Let the server know that this was a valid command
    return 1;
}



Re: Why isnt this working? - [L3th4l] - 04.01.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение
I don't know if anyone of you noticed, but OnPlayerCommandText IS public in his code ..
@OP: You need to respawn the vehicle for SetVehicleNumberPlate to work.
Well bud, he 'Edited'