Help needed, once again - 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)
+--- Thread: Help needed, once again (
/showthread.php?tid=643745)
Help needed, once again -
Uvais - 26.10.2017
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new Sparrow = GetVehicleModel(GetPlayerVehicleID(playerid));
if(PlayerClass[playerid] !== 8) { <<<<< Line 1650
if(Sparrow == 447) {
SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}You need to spawn as a pilot to drive air-vehicles.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid,x,y,z+1);
}
}
new Rhino = GetVehicleModel(GetPlayerVehicleID(playerid));
if(PlayerClass[playerid] !== 8) {
if(Rhino == 432) {
SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}You need to spawn as a pilot to drive air-vehicles.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid,x,y,z+1);
}
}
new Hydra = GetVehicleModel(GetPlayerVehicleID(playerid));
if(PlayerClass[playerid] !== 8) {
if(Hydra == 520) {
SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}You need to spawn as a pilot to drive air-vehicles.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid,x,y,z+1);
}
}
new Hunter = GetVehicleModel(GetPlayerVehicleID(playerid));
if(PlayerClass[playerid] !== 8) {
if(Hunter == 425) {
SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}You need to spawn as a pilot to drive air-vehicles.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid,x,y,z+1);
}
}
return 1;
}
Errors:
Код:
C:\Users\HP\Desktop\xw2\gamemodes\XWBeta12.pwn(1650) : error 029: invalid expression, assumed zero
C:\Users\HP\Desktop\xw2\gamemodes\XWBeta12.pwn(1650) : warning 215: expression has no effect
C:\Users\HP\Desktop\xw2\gamemodes\XWBeta12.pwn(1650) : error 001: expected token: ";", but found ")"
C:\Users\HP\Desktop\xw2\gamemodes\XWBeta12.pwn(1650) : error 029: invalid expression, assumed zero
C:\Users\HP\Desktop\xw2\gamemodes\XWBeta12.pwn(1650) : fatal error 107: too many error messages on one line
Can anyone help me solve this?
Re: Help needed, once again -
Lucases - 26.10.2017
Change !== to !=
Easy.
Re: Help needed, once again -
xMoBi - 26.10.2017
why r u using on player key state change?
correct code is this:
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
case 447, 432, 520:
{
if(PlayerClass[playerid] != 8)
{
SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}You need to spawn as a pilot to drive air-vehicles.");
new Float: x, Float: y, Float: z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+1);
return 1;
}
}
}
}
return 1;
}
Re: Help needed, once again -
Danisoni - 26.10.2017
Код:
if(PlayerClass[playerid] !== 8)
to
Код:
if(PlayerClass[playerid] != 8)
But as user up me said, replace that code to OnPlayerStateChange.