[GameMode] Very Basic Script
#20

Quote:
Originally Posted by ZigGamerx
View Post
This is a very basic script, this is more easy for newbies to learn MySQL easily. Who cares if you are a good scripter, learn to respect other works.

No Hate!! Just Truth.

Good work GTLS.
Kane was right, if you had read the whole script, you could have spotted some issues.

Mysql connection wasn't close at OnGameModeExit.
Player Name is stored in database but no idea why it was not used in script instead using GetPlayerName everytime!
`Users` and `USERS` should be `users` in onplayerconnect and OnPlayerDisconnect callback!


There is no need to login after the player register. It can be done by
pawn Code:
forward OnPlayerRegister(playerid);
public OnPlayerRegister(playerid)
{
         pInfo[playerid][MasterID] = cache_insert_id();
         pInfo[playerid][PX] = 1527.85;
         pInfo[playerid][PY] = -1675.35;
         pInfo[playerid][PZ] = 13.3828;
         pInfo[playerid][ROOT] = 270;
         pInfo[playerid][Skin] = 1;
         pInfo[playerid][Level] = 1;
    SetPlayerScore(playerid, pInfo[playerid][Level]);
    SetSpawnInfo(playerid, 0, pInfo[playerid][Skin], pInfo[playerid][PX], pInfo[playerid][PY], pInfo[playerid]
        [PZ],pInfo[playerid][Rot], 0, 0, 0, 0, 0, 0);
    SendClientMessage(playerid, 0x0033FFFF /*Blue*/, "Thank you for registering! You will be spawned now!");
    TogglePlayerSpectating(playerid, false);
    TogglePlayerControllable(playerid, true);
        SpawnPlayer(playerid);
    return 1;
}
And the last thing is , No Login detection was checked when player disconnect and no player variable for login check is defined.
When player disconnect, you should check if player logged in (after login/register) , so the data will be saved in mysql.
What if a player logins with an another player name and exist the server (Calls OnPlayerDisconnect)? or what if a player mistype his password and kicked out?
It will save the player's current position and will be stored into the database under the player name. So, that's why the script needs a login variable.

Anyways Good work!
Reply


Messages In This Thread
Very Basic Script - by GTLS - 23.07.2019, 16:55
Re: Very Basic Script - by N4Sti - 23.07.2019, 17:22
Re: Very Basic Script - by ZigGamerx - 23.07.2019, 17:26
Re: Very Basic Script - by NeXTGoD - 23.07.2019, 18:04
Re: Very Basic Script - by GTLS - 24.07.2019, 04:06
Re: Very Basic Script - by ZigGamerx - 24.07.2019, 09:18
Re: Very Basic Script - by GTLS - 24.07.2019, 10:04
Re: Very Basic Script - by GeorgeMcReary - 24.07.2019, 10:20
Re: Very Basic Script - by Mobtiesgangsa - 24.07.2019, 19:59
Re: Very Basic Script - by Kane - 24.07.2019, 21:18
Re: Very Basic Script - by kukboy - 24.07.2019, 21:48
Re: Very Basic Script - by Josh_Main - 25.07.2019, 08:59
Re: Very Basic Script - by GTLS - 25.07.2019, 09:23
Re: Very Basic Script - by Huemerson - 25.07.2019, 12:49
Re: Very Basic Script - by sonn51280 - 25.07.2019, 13:10
Re: Very Basic Script - by ZigGamerx - 25.07.2019, 14:02
Re: Very Basic Script - by GTLS - 27.07.2019, 09:23
Re: Very Basic Script - by PhantomThief1412 - 04.08.2019, 14:36
Re: Very Basic Script - by ZigGamerx - 04.08.2019, 18:39
Re: Very Basic Script - by SiaReyes - 05.08.2019, 13:20
Re: Very Basic Script - by GeorgeMcReary - 05.08.2019, 16:09
Re: Very Basic Script - by GTLS - 05.08.2019, 16:27
Re: Very Basic Script - by SiaReyes - 05.08.2019, 16:35
Re: Very Basic Script - by Calisthenics - 05.08.2019, 17:16
Re: Very Basic Script - by GTLS - 06.08.2019, 06:59
Re: Very Basic Script - by Calisthenics - 06.08.2019, 08:04
Re: Very Basic Script - by GTLS - 06.08.2019, 08:58
Re: Very Basic Script - by Calisthenics - 06.08.2019, 11:59
Re: Very Basic Script - by GTLS - 07.08.2019, 16:47
Re: Very Basic Script - by Mugala - 08.08.2019, 23:21

Forum Jump:


Users browsing this thread: 1 Guest(s)