21.11.2010, 01:58
I want it so that it saves the players last known position and when they relog in they go to their last known position.
This is my disconnecting code:
But it doesn't work and I get warnings
.
Here is my Login code:
Here is the warnings I get:
Here is line 153:
This is my disconnecting code:
Code:
public OnPlayerDisconnect(playerid, reason) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(gPlayerLogged[playerid] == 1) { new pCashs; //Player Money pCashs = GetPlayerMoney(playerid); //gets the amount of playercash dini_IntSet(file, "Money",pCashs); // puts it into file under "Money" new pSkins; //Player Skins pSkins = GetPlayerSkin(playerid); //Gets the player's skins dini_IntSet(file, "Skin",pSkins); //Puts it into file under "Skin" new pScores; //Player Score/Level pScores = GetPlayerScore(playerid); //Gets the player's score dini_IntSet(file, "Score",pScores); //Puts it into file under "Score" new pPosition; //Player Position pPosition = GetPlayerPos(playerid); //Gets the Player's score dini_IntSet(file, "Position",pPosition); //Puts it into file under "Position" } gPlayerLogged[playerid] = 0; return 1; }

Here is my Login code:
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if (dialogid == 1) { new name[MAX_PLAYER_NAME], file[256], string[128]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(!response) return Kick(playerid); if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Account Not Registered", "Account Not Registered, Please Type A Password Below:", "Register", "Leave"); dini_Create(file); dini_IntSet(file, "Password", udb_hash(inputtext)); dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0); dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500); dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0); dini_IntSet(file, "Health",PlayerInfo[playerid][pHealth] = 100); dini_IntSet(file, "Armour",PlayerInfo[playerid][pArmour] = 0); dini_IntSet(file, "Skin",PlayerInfo[playerid][pSkin] = 2); format(string, 128, "[SYSTEM]: Account Successfully Registered", name, inputtext); SendClientMessage(playerid, COLOR_GREEN, string); gPlayerLogged[playerid] = 1; } if (dialogid == 2) { new name[MAX_PLAYER_NAME], file[256]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), SERVER_USER_FILE, name); if(!response) return Kick(playerid); if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Account Already Registered", "Welcome Back, Type Your Password Below:", "Login", "Leave"); new tmp; tmp = dini_Int(file, "Password"); if(udb_hash(inputtext) != tmp) { SendClientMessage(playerid, COLOR_RED, "The Password Which Was Entered Was Incorrect"); ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Account Already Registered", "Welcome Back, Type Your Password Below:", "Login", "Leave"); } else { gPlayerLogged[playerid] = 1; PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel"); SetPlayerScore(playerid, dini_Int(file, "Score")); SetPlayerArmour(playerid, dini_Int(file, "Armour")); SetPlayerHealth(playerid, dini_Int(file, "Health")); SetPlayerSkin(playerid, dini_Int(file, "Skin")); GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid)); SendClientMessage(playerid,COLOR_GREEN, "[SYSTEM]: Successfully logged in!"); } } return 1; }
Code:
C:\Users\SoSu\Desktop\SAMP Server\gamemodes\roleplaytraining.pwn(153) : warning 202: number of arguments does not match definition C:\Users\SoSu\Desktop\SAMP Server\gamemodes\roleplaytraining.pwn(153) : warning 202: number of arguments does not match definition C:\Users\SoSu\Desktop\SAMP Server\gamemodes\roleplaytraining.pwn(153) : warning 202: number of arguments does not match definition Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 3 Warnings.
Code:
pPosition = GetPlayerPos(playerid); //Gets the Player's score