23.01.2015, 16:46
When I die in my game, I get this error and the whole screen turns strange.
I have these things that do something with spawning:
What can I remove and what can I improve?
I have these things that do something with spawning:
Код:
public OnGameModeInit() { DisableInteriorEnterExits(); print("Gamemode Started."); return 1; }
Код:
public OnPlayerSpawn(playerid) { PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid); //i dont know your variables SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); SetSpawnInfo(playerid, 0, 79, 1549.6141, -1675.5640, 15.0438, 91.6558, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); return 1; }
Код:
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_PASSWORD, ""COLOR_WHITE"Registering...",""COLOR_RED"You have entered an invalid password.\n"COLOR_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,"Rights",0); INI_WriteInt(File,"Skin",79); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SetSpawnInfo(playerid, 0, 79, 1549.6141, -1675.5640, 15.0438, 91.6558, 0, 0, 0, 0, 0, 0); SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); SpawnPlayer(playerid); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); SetSpawnInfo(playerid, 0, 79, 1549.6141, -1675.5640, 15.0438, 91.6558, 0, 0, 0, 0, 0, 0); SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); SpawnPlayer(playerid); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COLOR_WHITE"Login",""COLOR_RED"You have entered an incorrect password.\n"COLOR_WHITE"Type your password below to login.","Login","Quit"); } return 1; } } } return 1; }
Код:
public OnPlayerDisconnect(playerid, reason) { new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)); INI_WriteInt(File,"Rights",PlayerInfo[playerid][pRights]); INI_WriteInt(File,"Skin",GetPlayerSkin(playerid)); INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]); INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]); INI_Close(File); SetSpawnInfo(playerid, 0, 79, 1549.6141, -1675.5640, 15.0438, 91.6558, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); return 1; }
Код:
public OnPlayerDeath(playerid, killerid, reason) { PlayerInfo[killerid][pKills]++; PlayerInfo[playerid][pDeaths]++; return 1; }