why this works for ID 0, but not for ID 1 and higher? -
niels44 - 06.05.2012
hey guys,
i have been busy with my new GM the whole day but now im stuck... i just cant find a way how to fix this..., cuz this works for ID 0 but when there joins someone and does the same it DOESNT works

, please someone knows how to fix this?, i already tried it with a loop but that didnt work either...
pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == startmenu)
{
switch(row)
{
case 0: // get a car
{
if(HasCar[playerid] == 0)
{
new allvehicles[] = "1\tBikes\n2\tConvertibles\n3\tLowriders\n4\tOffRoad\n5\tPublic Service Vehicles\n6\tSaloons\n7\tSport Vehicles\n8\tStation Wagons";
ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST," Vehicles: || Scroll Down for more",allvehicles,"Select","Cancel");
return 1;
}
else if(HasCar[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "ERROR: you can't spawn more then 1 car at the time");
}
}
case 1: // hit the road
{
if(HasCar[playerid] == 1)
{
SetPlayerCameraPos(playerid,2518.2378,-1535.4877,24.0190);
SetPlayerCameraLookAtEx(playerid, 2520.8469,-1537.4227,24.0190);
MovePlayerCamera(playerid,2508.6433,-1547.5991,24.9592, 5.0,2513.9517,-1532.4204,24.0190);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
SetVehiclePos(newcar, 2511.9880,-1529.9948,23.9994);
SetVehicleZAngle(newcar, 359.3965);
SetTimer("StartDriving", 5000, 0);
}
else if(HasCar[playerid] != 1)
{
ShowMenuForPlayer(startmenu, playerid);
return SendClientMessage(playerid, COLOR_RED, "ERROR: you should first get a car");
}
return 1;
}
case 2: // change car
{
if(HasCar[playerid] == 1)
{
HasCar[playerid] = 0;
DestroyVehicle(newcar);
SetTimer("changecar",2000, 0);
}
else if(HasCar[playerid] != 1) return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you haven't spawned ANY car yet");
}
case 3: // quit game
{
SendClientMessage(playerid, COLOR_ORANGE, "See Ya!");
Kick(playerid);
}
}
}
return 1;
}
forward changecar(playerid);
public changecar(playerid)
{
new allvehicles[] = "1\tBikes\n2\tConvertibles\n3\tLowriders\n4\tOffRoad\n5\tPublic Service Vehicles\n6\tSaloons\n7\tSport Vehicles\n8\tStation Wagons";
ShowPlayerDialog(playerid,2,DIALOG_STYLE_LIST," Vehicles: || Scroll Down for more",allvehicles,"Select","Cancel");
return 1;
}
forward StartDriving(playerid);
public StartDriving(playerid)
{
if(HasCar[playerid] == 1)
{
if(IsPlayerCameraMoving(playerid)) StopPlayerCamera(playerid);
StopRunningCameras(true);
PutPlayerInVehicle(playerid, newcar, 0);
SendClientMessage(playerid, COLOR_RED, "Have Fun!, type /garage if you wanna go back to your garage");
SetCameraBehindPlayer(playerid);
HasCar[playerid] = 0;
TogglePlayerControllable(playerid, 1);
printf("player in vehicle");
return 1;
}
else if(HasCar[playerid] != 1) return SendClientMessage(playerid, COLOR_RED, "ERROR: you should first get a car!");
return 1;
}
the problem is, that when pressing "hit the road", it should move the camera for the player to another palce as you can see in the code, and then the car gets set to another place and then after 5 seconds it should put the player in teh car and the player can drive away, and all works PERFECT, but only for ID 0, for other ID's when pressing hit the road, then the camera doesnt moves and nuthing happens, and then when the 5 seconds are over, then as you can see in the last part of teh code: StartDriving; then you see that when HasCar is not 1, it says: you should first get a car, but that message doesnt gets send to the good player but to ID 0

anyone knows how to fix it that it works for each player ?, and doesnt sends a message which is supposed to send to ID 1 not gets send to ID 0?
REP+ for EVERYONE who helps me fixing this
greets niels
Re: [REP++++]why this works for ID 0, but not for ID 1 and higher? -
ViniBorn - 06.05.2012
Use SetTimerEx
pawn Код:
SetTimerEx("StartDriving", 5000, false, "d", playerid);
pawn Код:
SetTimerEx("changecar", 2000, false, "d", playerid);
Re: why this works for ID 0, but not for ID 1 and higher? -
niels44 - 06.05.2012
lol would that fix the problem? i dont see the difference in it but i will try it

thnx

, if it works you get REP+
Re: why this works for ID 0, but not for ID 1 and higher? -
niels44 - 06.05.2012
hmm it works... but for a part... the player gets in his vehicle etc, but the camera of the player doesnt changes.. so i think a part of the code doesnt works yet

, any other suggestions?
well actually it does change the camera... its just, sometimes it works, other time it doenst works

, should i still use a loop?
Re: why this works for ID 0, but not for ID 1 and higher? -
niels44 - 07.05.2012
Anyone?
Re: why this works for ID 0, but not for ID 1 and higher? -
[D]ry[D]esert - 07.05.2012
https://sampforum.blast.hk/showthread.php?tid=339361
Re: why this works for ID 0, but not for ID 1 and higher? -
niels44 - 07.05.2012
eehm i dont think that will work, cause i havent even used sscanf yet... i only included it nothing more... anyways i updated it and i still have to test if it works now but i dont think so, so any other suggestions?