Some Server Bugs -
avian960 - 08.04.2014
Im trying to script a LV RP server , some people helping me , because im a new scripter :3
[1]
So here is the prob , i mapped the LV-PD Base , In MTA Program , so i added the objects , and i added some cars ,
now when adding cars to the script its look like this:
AddStaticVehicleEx(598,2256.5000000,2444.4000000,1 0.7000000,0.0000000,-1,-1,15); //Police Car (LVPD)
i dont know if its wrong , or there is anthore way to spawn cars?
Now when i enter to the car and drive away abit , and then go out from the car for 5 secounds , the car respawns
how can i fix it ?! (Car Respawns Every 5 sec....)
[2]
and how i add a thing like this
' you are not allowed to enter this vehicle , you are not in LVPD team '
[3] ~~ Big Problem ~~~
Every time when im trying to add filescripts
and the servers trys to load them it says 'Unable to load xxx.amx' Why?!
[ Srry For Bad English

]
[++] If Some one knows good scripting pm me , i will show him my gamemode scripting file , and help me to fix it [++]
Re: Server Vehicle Respawn Bug? -
Flake. - 08.04.2014
pawn Код:
new lvpdcar; //Making the global define for lvpdcar
//OnGamemodeInit
lvpdcar = AddStaticVehicleEx(598,2256.5000000,2444.4000000,1 0.7000000,0.0000000,-1,-1, 15); //Police Car (LVPD)
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if(vehicle > lvpdcar) //checking if they entered that specific car
{
if(GetPlayerTeam(playerid) == 1) //Checking if the players team is equal to 1
{
SendClientMessage(playerid, COLOR_RED, "You've entered a LVPD car");
return 1;
}
else RemovePlayerFromVehicle(playerid); //Removing them from the vehicle if they're not in LVPD
}
return 1;
}
Something like that should work, or at least give you a picture of how to do it
Re: Server Vehicle Respawn Bug? -
ChuckyBabe - 08.04.2014
Quote:
Originally Posted by (*|Flake|*)
pawn Код:
new lvpdcar; //Making the global define for lvpdcar
//OnGamemodeInit lvpdcar = AddStaticVehicleEx(598,2256.5000000,2444.4000000,1 0.7000000,0.0000000,-1,-1, 15); //Police Car (LVPD)
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { new vehicle; vehicle = GetPlayerVehicleID(playerid); if(vehicle > lvpdcar) //checking if they entered that specific car { if(GetPlayerTeam(playerid) == 1) //Checking if the players team is equal to 1 { SendClientMessage(playerid, COLOR_RED, "You've entered a LVPD car"); return 1; } else RemovePlayerFromVehicle(playerid); //Removing them from the vehicle if they're not in LVPD } return 1; }
Something like that should work, or at least give you a picture of how to do it 
|
I think RemovePlayerFromVehicle(playerid); is only working for OnPlayerKeyState?
SAMP WIKI
https://sampwiki.blast.hk/wiki/RemovePlayerFromVehicle
EDIT : This function will not work when used in OnPlayerEnterVehicle, because the player isn't in the vehicle when the callback is called. Use OnPlayerStateChange (newstate == 2/PLAYER_STATE_DRIVER) instead.
Re: Server Vehicle Respawn Bug? -
Flake. - 08.04.2014
Quote:
Originally Posted by ChuckyBabe
|
You're right
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
{
Replace it with something like that, pretty much the same idea.
Re: Some Server Bugs -
Ari - 08.04.2014
pawn Код:
new LVPDcar[1]; // Add to the global scope
// OnGameModeInit()
//(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2, respawn_delay)
LVPDcar[0] = AddStaticVehicleEx(598, 2256.5, 2444.4, 10.7, 0.00, 0, 1, -1);
//LVPDcar[1] = AddStaticVehicleEx(598, 2256.5, 2444.4, 10.7, 0.00, 0, 1, -1); You can add more in different places if you wish
// The last parameter has been adjusted to -1 which means it will remain spawned. (should fix the "5" second bug)
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
{
new currentVehicleID = GetPlayerVehicleID(playerid);
for(new i = 0; i < sizeof(LVPDcars); ++i)
if(currentVehicleID == LVPDcar[i] && GetPlayerTeam(playerid) != 1)
{
SendClientMessage(playerid, COL_GREY, "ERR: You're not in the LVPD team!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
Written at 2 AM, post any problems (if any) and I will fix them in the morning
As for your Filterscript issue, make sure they've got no compiling errors, they're in the correct /filterscripts/ folder and they're compiled into .amx.
Re: Some Server Bugs -
avian960 - 08.04.2014
yea... i suck at scripting ,but any way.. when im trying to create the stuff you gave me ,when i press Compile\Run
thats what i get:
error 001: expected token: ",", but found "-rational value-"
C:\Documents and Settings\****\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(3

: warning 215: expression has no effect
C:\Documents and Settings\****\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(3

: warning 215: expression has no effect
C:\Documents and Settings\****\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(3

: warning 215: expression has no effect
C:\Documents and Settings\****\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(3

: warning 215: expression has no effect
C:\Documents and Settings\Alex\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(3

: warning 215: expression has no effect
C:\Documents and Settings\****\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(3

: error 001: expected token: ";", but found ")"
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(3

: error 029: invalid expression, assumed zero
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(3

: fatal error 107: too many error messages on one line
OR
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(42) : error 029: invalid expression, assumed zero
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(42) : error 017: undefined symbol "playerid"
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(44) : error 017: undefined symbol "oldstate"
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(46) : error 017: undefined symbol "playerid"
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(4

: error 017: undefined symbol "LVPDcars"
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(4

: error 036: empty statement
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(4

: error 017: undefined symbol "i"
C:\Documents and Settings\0\Рабочий стол\LV-RP LIFE\filescripts\lvpdcars.pwn(4

: fatal error 107: too many error messages on one line
Re: Some Server Bugs -
avian960 - 08.04.2014
I Know its easy for you , but i dont now shit in scripting so please dont laught
Re: Some Server Bugs -
azzerking - 08.04.2014
try this (Modified Ari Code):
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
{
new currentVehicleID = GetPlayerVehicleID(playerid);
for(new i = 0; i < sizeof(LVPDcars); ++i)
{
if(currentVehicleID == LVPDcar[i] && GetPlayerTeam(playerid) != 1)
{
SendClientMessage(playerid, COL_GREY, "ERR: You're not in the LVPD team!");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
Should have fixed it
Re: Some Server Bugs -
avian960 - 09.04.2014
More errors
C:\Documents and Settings\z\Рабочий стол\Country Side RP\gamemodes\lvrp.pwn(5199) : error 029: invalid expression, assumed zero
C:\Documents and Settings\z\Рабочий стол\Country Side RP\gamemodes\lvrp.pwn(5199) : error 017: undefined symbol "playerid"
C:\Documents and Settings\z\Рабочий стол\Country Side RP\gamemodes\lvrp.pwn(5201) : error 017: undefined symbol "oldstate"
C:\Documents and Settings\z\Рабочий стол\Country Side RP\gamemodes\lvrp.pwn(5203) : error 017: undefined symbol "playerid"
C:\Documents and Settings\z\Рабочий стол\Country Side RP\gamemodes\lvrp.pwn(5205) : error 017: undefined symbol "LVPDcars"
C:\Documents and Settings\z\Рабочий стол\Country Side RP\gamemodes\lvrp.pwn(5205) : error 036: empty statement
C:\Documents and Settings\z\Рабочий стол\Country Side RP\gamemodes\lvrp.pwn(5205) : error 017: undefined symbol "i"
C:\Documents and Settings\z\Рабочий стол\Country Side RP\gamemodes\lvrp.pwn(5205) : fatal error 107: too many error messages on one line