OnPlayerStateChange » » Enter !!
#1

Quote:

public OnPlayerStateChange(playerid, newstate, oldstate)
{

new vehicleid = GetPlayerVehicleID(playerid);
new caridx = CarSysID[vehicleid];
for(new i; i < MAX_VEHICLES; i++)
{
if(vehicleid == PizzaBoy[i] && InPizzaMission[playerid] == 1 && PizzaMissionStarted == 1 && newstate == PLAYER_STATE_ONFOOT)
{
InPizzaMission[playerid] = 0;
PizzaMissionStarted = 0;
DestroyVehicle(PizzaBoy[i]);
SetVehicleToRespawn(PizzaBoy[i]);
SetPlayerVirtualWorld(playerid, 0);
DisablePlayerRaceCheckpoint(playerid);
SpawnPlayer(playerid);
SendClientMessage(playerid,COLOR_ORANGE,"!йцаъ одшлб ерфсмъ бощйод");
KillTimer(PizzaMission2[playerid]);
format(String,sizeof(String),".ма дтбйш аъ дощмез бжоп \"%s\" щмйз дфйцд",GetName(playerid));
SendClientMessageToAll(COLOR_ORANGE,String);
}
}
for(new i; i < MAX_VEHICLES; i++)
{
if(vehicleid == admincars[i] && !IsPlayerDAdmin(playerid)&& newstate == PLAYER_STATE_DRIVER)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+7);
PlayerPlaySound(playerid, 1136, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~Admins Vehicle!",3000,4);
SendClientMessage(playerid, COLOR_KRED, "!айрк йлем мдлрс мшлб цееъ");
}
if(vehicleid == vipcars[i] && IsPlayerInAnyVehicle(playerid) && newstate == PLAYER_STATE_DRIVER && userdata[playerid][userisvip] == 0)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+7);
PlayerPlaySound(playerid, 1136, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~VIP Vehicle!",3000,4);
SendClientMessage(playerid, COLOR_KRED, "!V.I.P айрк йлем мдлрс мшлб");
}
if(vehicleid == carshop[i] && IsPlayerInAnyVehicle(playerid) && newstate == PLAYER_STATE_DRIVER)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+7);
PlayerPlaySound(playerid, 1136, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~Display Vehicle!",3000,4);
SendClientMessage(playerid, COLOR_KRED, "!айрк йлем мдлрс мшлб ъцевд");
}

}

// ================================= Normal =========================================== ///
if(newstate == PLAYER_STATE_DRIVER)
{
SetPlayerArmedWeapon(playerid,0);
}
if(newstate == PLAYER_STATE_DRIVER)
{
if(vehdata[caridx][carowned] == 1 && !strcmp(GetName(playerid), vehdata[caridx][carowner], true))
{
format(String,sizeof(String),"{FF9900}\"%s\" {FFFFFF}:щйвшъ аъ шлбк осев",VehNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
SendClientMessage(playerid,-1,String);
if(userdata[playerid][insurance] == 0) return SendClientMessage(playerid,COLOR_KRED,"/InsuranceHelp - айп мк бйиез мшлб");
if(userdata[playerid][insurance] == 1) {
format(String,sizeof(String), "{FFFFFF}.дйре шлб обеиз {FF0000}\"%s\" {FFFFFF}:шлб",VehNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
SendClientMessage(playerid,-1,String);
SendClientMessage(playerid,-1,"/Fix - мъйчеп дшлб добеиз шщен");
}
}
else if(vehdata[caridx][carowned] == 1 && strcmp(GetName(playerid), vehdata[caridx][carowner], true) && vehdata[caridx][carsetprice] != 0)
{
format(String, 256, "./BuyCar еоецт молйшд бозйш щм $%d тм оръ мшлещ шлб жд шщен %s шлб жд роца ббтмеъ дщзчп",vehdata[caridx][carsetprice], vehdata[caridx][carowner]);
SendClientMessage(playerid, COLOR_KRED, String);
}
else if(vehdata[caridx][carowned] == 1 && strcmp(GetName(playerid), vehdata[caridx][carowner], true))
{
format(String, 256, ".%s шлб жд роца ббтмеъ дщзчп", vehdata[caridx][carowner]);
SendClientMessage(playerid, COLOR_KRED, String);
}
}




if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
if(LastVehicleTick[playerid] == -1)
{
LastVehicleTick[playerid] = GetTickCount();
}
else
{
if( ( GetTickCount() - LastVehicleTick[playerid] ) <= 100)
{
LastVehicleWarns[playerid]++;

if(LastVehicleWarns[playerid] >= 2)
{
format(SAC_WeaponString, 120, "GC_Guard: %s has been kicked from the server (Vehicle Hacks).", GetName(playerid));
SendClientMessageToAll(COLOR_KRED, SAC_WeaponString);
SendClientMessageToAll(COLOR_YELLOW, "[Anti-Cheat] All vehicles has been respawned due to vehicle hacks being detected.");
SetTimerEx("KickPlayer",200,false,"i",playerid);
Kick(playerid);
KillTimer(respawncarstimer);
respawncarstimer = SetTimer("RespawnAllCars", 1000, 0);
}
}
}
}

LastVehicleTick[playerid] = GetTickCount();


if(newstate == PLAYER_STATE_ONFOOT)
{
SetPlayerArmedWeapon(playerid, 0);
SAC_WeaponCheck[playerid] = 0;
SAC_RealWeapCheck[playerid] = SetTimerEx("RealWeaponCheck", 1500, 0, "i", playerid);
}

if(oldstate == 2 && newstate != 2 && AntiOn[playerid] != 0 && MyVeh[playerid] > -1) return PutPlayerInVehicle(playerid,MyVeh[playerid],0);

if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
if(userdata[playerid][usercodetype] == 7 && AntiOn[playerid] == 1)
{
AntiOn[playerid] = 1;
}
}

if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER && newstate == PLAYER_STATE_ONFOOT)
{
if(userdata[playerid][usercodetype] == 7 && AntiOn[playerid] == 1)
{
PutPlayerInVehicle(playerid, MyVeh[playerid], 0);
}
}

return 1;
}

Well... when player enters vehicle he got crashed. I just want you guys to figure out why is that happening ? :O
Thanks a lot !
Reply
#2

@******
Reply
#3

Ok, then wait for ****** to help you.
Reply
#4

Quote:
Originally Posted by Undef1ned
Посмотреть сообщение
Ok, then wait for ****** to help you.
Tbh his knowledg about pawn is pretty good and idk someone else... Maybe you could help me ?
Reply
#5

Do not use those loops again, it affects the server a lot. Try to make a "DEBUG" of this callback, put the prints at every step, after each line even see to what point they are executed, there must be the problem.

Something like that:

Код:
public OnPlayerConnect(playerid)
{
print("OnPlayerConnect Start");
SendClientMessage(playerid, -1, "TEXT");
print("SendClientMessage SEND");
SetPlayerPos(playerid, 0.0, 0.0, 0.0); // only for example
print("Player Position Updated"); 
return 1;
}

And see how far it went.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)