SA-MP Forums Archive
Need 2 Commands.. They don't work.. - 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: Need 2 Commands.. They don't work.. (/showthread.php?tid=190250)



Need 2 Commands.. They don't work.. - [SP]Badman - 14.11.2010

Hello..

I am just trying to make a script for a car spawner...
But my car spawner won't work.. I can't just script properly..

Second.. I can't make a /repair command, Like /repair to fix the car , also Numpad + to fix the car too.. I can't really find a solution, someone please help?


Re: Need 2 Commands.. They don't work.. - Las Venturas CNR - 14.11.2010

For the command:

pawn Код:
if (!strcmp("/repair", cmdtext))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
        return 1;
    }

You will need to use "OnPlayerKeyStateChange" for the numpad one. I don't think "+" is a detectable key.

More information: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange


Re: Need 2 Commands.. They don't work.. - [SP]Badman - 14.11.2010

Thank's Mate


Re: Need 2 Commands.. They don't work.. - The_Moddler - 14.11.2010

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_SUBMISSION)
    {
        RepairVehicle(GetPlayerVehicleID(playerid));
        SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
    }
    return 1;
}
That will work if you press number 2, the one that is above the key 'W'.