07.08.2011, 08:31
Hello. I wanted to ask 1 question.
I have this command:
But most important is theese lines:
Why sometimes in game firstly runs SetPlayerInterior(playerid,15); and after that PInterior[playerid] = GetPlayerInterior(playerid); ? Yesterday it happened to me. I joined into derby, and when i left, my interior was 15. So it means that firstly server set my interior to 15 and after that it saved my interior. It's not the first time with this problem.
I have this command:
pawn Код:
dcmd_derby(playerid, params[])
{
#pragma unused params
if(DerbyStarted == 1)
{
SendClientMessage(playerid,COLOR_MAIN,"* Too late, derby already started *");
return 1;
}
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_MAIN,"* Firstly leave vehicle *");
return 1;
}
if(FirstJoinDerby == 0)
{
PlayersInDerby = 1;
FirstJoinDerby = 1;
DerbyTimer = SetTimer("StartDerby",30000,0);
SendClientMessageToAll(COLOR_MAIN,"* Derby is starting after 30 seconds. /derby to join *");
}
else
{
PlayersInDerby++;
switch (PlayersInDerby)
{
case 50:
{
KillTimer(DerbyTimer);
DerbyTimer = SetTimer("CheckDerby",1000,1);
DerbyStarted = 1;
ForEach(i,MAX_SLOTS)
{
if(PlayerI[i][InDerby] == 1)
{
GameTextForPlayer(i,"DERBY HAS STARTED", 3000, 3);
new Float:X,Float:Y,Float:Z;
new Float:Angle; GetPlayerPos(i, X, Y, Z);
GetVehicleZAngle(CreatedRaceVeh[i], Angle);
SetVehiclePos(CreatedRaceVeh[i], X, Y, Z);
SetVehicleZAngle(CreatedRaceVeh[i], Angle);
RepairVehicle(CreatedRaceVeh[i]);
}
}
}
}
}
PlayerI[playerid][InDerby] = 1;
PlayerI[playerid][InEvent] = 1;
PInterior[playerid] = GetPlayerInterior(playerid);
GetPlayerPos(playerid,PosX[playerid],PosY[playerid],PosZ[playerid]);
SetPlayerInterior(playerid,15);
new rand = random(17);
CreatedRaceVeh[playerid] = AddStaticVehicleEx(504,DerbyPos[rand][0],DerbyPos[rand][1],DerbyPos[rand][2],DerbyPos[rand][3],VC(random(155)),VC(random(155)),180);
SetPlayerPos(playerid,DerbyPos[rand][0],DerbyPos[rand][1],DerbyPos[rand][2]);
SetPlayerVirtualWorld(playerid,3);
SetVehicleVirtualWorld(CreatedRaceVeh[playerid],3);
LinkVehicleToInterior(CreatedRaceVeh[playerid],15);
PutPlayerInVehicle(playerid,CreatedRaceVeh[playerid],0);
DerbyObject[playerid] = CreateObject(1245,0,0,0,0,0,0,200);
AttachObjectToVehicle(DerbyObject[playerid],CreatedRaceVeh[playerid],-1.014999, 3.140024, 0.050000, -0.000000, -6.029999, 91.409912);
return 1;
}
pawn Код:
PInterior[playerid] = GetPlayerInterior(playerid);
GetPlayerPos(playerid,PosX[playerid],PosY[playerid],PosZ[playerid]);
SetPlayerInterior(playerid,15);