24.02.2012, 01:49
I am having some bugs involving player ids, everything works fine when i am the only one in the server, but when others join they get bugged, such as if id 0 is in the tutorial and /q then id 1 gets put in tutorial, can someone tell me why this happens? I am making a game mode from scratch. I think it has something to do with max players or such but i JUST dont know.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Tutorial",1);
INI_WriteInt(File,"Job",0);
INI_WriteInt(File,"TruckingSkill",1);
INI_WriteInt(File,"DeliveryRoute",0);
INI_WriteInt(File,"Hours",0);
INI_WriteInt(File,"Level",1);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerScore(playerid, 1);
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid, 0x1DF279FF, "You are now going to be taken to the Tutorial");
SetTimer("TutorialA", 1000, false);
}
forward TutorialA(playerid);
public TutorialA(playerid)
{
TogglePlayerControllable(playerid, 0);
SetPlayerPos(playerid, 1547.2268,-1522.9756,171.5264);
SetPlayerCameraPos(playerid, 1547.2268,-1522.9756,171.5264);
SetPlayerCameraLookAt(playerid, 1630.2454, -1296.0814, 126.2841);
SendClientMessage(playerid, 0x1DF279FF, "................................::RULES::......................................");
SendClientMessage(playerid, 0x1DF279FF, "This is a Role Play server, this means you play the role of a certain character");
SendClientMessage(playerid, 0x1DF279FF, "There are of course some rules and regulations here in order to keep things fair and");
SendClientMessage(playerid, 0x1DF279FF, "and fun. There is to be no Death Matching aka killing for no reason. It is lame and won't");
SendClientMessage(playerid, 0x1DF279FF, "get you anything but, PWN3D or admin prisoned. In Character involves your in game world, be");
SendClientMessage(playerid, 0x1DF279FF, "sure not to mix Out of Character(real life) information with In character Information, it is");
SendClientMessage(playerid, 0x1DF279FF, " important to learn to keep these two things seperate. To see all rules type /rules");
SetTimer("Tutorial", 25000, false);
}
forward Tutorial(playerid);
public Tutorial(playerid)
{
SetPlayerPos(playerid, 2259.2664, -2205.5503, 37.0754);
SetPlayerCameraPos(playerid, 2259.2664,-2205.5503,37.0754);
SetPlayerCameraLookAt(playerid, 2174.3184,-2265.0876,13.3641);
SendClientMessage(playerid, 0x1DF279FF, "...........................:JOBS:.........................");
SendClientMessage(playerid, 0x1DF279FF, " As of right now this server has 3 jobs, Arms dealer, Mechanic, and Trucker.");
SendClientMessage(playerid, 0x1DF279FF, " Trucking is your best start at making money, it is fairly easy and fun to do.");
SendClientMessage(playerid, 0x1DF279FF, "All of the job commands can be found in the new players /guide");
SendClientMessage(playerid, 0x1DF279FF, "Jobs are a good way to make money to buy things such as cars, and houses");
SetTimer("Tutorial2", 25000, false);
}
forward Tutorial2(playerid);
public Tutorial2(playerid)
{
TogglePlayerControllable(playerid, 1);
SetSpawnInfo(playerid, 0, 0, 1804.7491, -1861.8438,13.5770, 352.7599, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}