27.06.2013, 22:26
Well, for some reason, my spawning is bugged. When I register an account, it correctly adds the positions and stuff to the players account, and I'm using the SAME variable to set the players spawn, but it instead spawns him in the air, with a glitched 299 skinid, and my characters flies up in the air and in a certain direction, for no reason. This is an image as to what I am talking about:
http://i.imgur.com/EVpmhpg.png
This is the script:
Instead of using SetSpawnInfo should I set the players position under OnPlayerSpawn?
EDIT: I set their spawn / skin under OnPlayerSpawn as-well but he did the same thing.
http://i.imgur.com/EVpmhpg.png
This is the script:
pawn Код:
/*
--------------------------------------------------------------------
___ _ _ _ ___ _ _
| _ \___| |___ _ __| |__ _ _ _ | |__ _ _ / __| |_ _____ _____| |__ _ ___
| / _ \ / -_) '_ \ / _` | || | | '_ \ || | \__ \ _/ -_) V / _ \ / _` (_-<
|_|_\___/_\___| .__/_\__,_|\_, | |_.__/\_, | |___/\__\___|\_/\___/_\__,_/__/
|_| |__/ |__/
Roleplay Script by Stevolas
------[SCRIPT CREDITS]------
[*****] Stevolas
--------------------------------------------------------------------
*/
#include <a_samp>
#include <a_mysql>
#include <zcmd>
#include <sscanf2>
#include "../include/gl_common.inc"
#include <YSI\y_timers>
#define MIN_PASSWORD_LENGTH (6)
#define MAX_PASSWORD_LENGTH (128)
#define MAX_INCORRECT_PASSWORD_ATTEMPTS (3)
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_RED 0xAA3333AA
#define COLOR_ORANGE 0xFF8000FF
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_CYAN 0x40FFFFFF
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_BLACK 0x000000AA
#define COLOR_WHITE 0xFFFFFFAA
#define DIALOG_LOGIN (1)
#define DIALOG_REGISTER (2)
#define THREAD_USERNAME_LOOKUP (1)
#define THREAD_USERNAME_REGISTER (2)
#define THREAD_LOAD_PLAYER (3)
#define THREAD_REGISTER_PLAYER (4)
#define THREAD_NO_RESULT (5)
#define DEVELOPMENT_VERSION "v0.1"
#define SERVER_NAME "Unknown Society Roleplay"
#define SERVER_SHORT_NAME "US:RP"
#define DEVELOPER_NAMES "Steven"
forward OnQueryFinish(query[], resultid, extraid, connectionHandle);
native WP_Hash(buffer[], len, const str[]);
enum ePlayerData
{
pId,
pUsername[MAX_PLAYER_NAME],
pPassword[MAX_PASSWORD_LENGTH],
Float:pPos[4],
pStatus,
pSkin
}
new PlayerInfo[MAX_PLAYERS][ePlayerData];
new iConnectionHandle;
main()
{
print("\n----------------------------------");
print("Survival Roleplay by Steven");
print("----------------------------------\n");
}
public OnGameModeInit()
{
iConnectionHandle = mysql_connect("localhost", "root", "test", "");
SetGameModeText(SERVER_SHORT_NAME " " DEVELOPMENT_VERSION);
return 1;
}
public OnGameModeExit()
{
mysql_close(iConnectionHandle);
return 1;
}
public OnQueryError(errorid, error[], callback[], query[], connectionHandle)
{
switch(errorid)
{
default: printf("Error #%d - Error: %s | Query: %s", errorid, error, query);
}
return 1;
}
public OnQueryFinish(query[], resultid, extraid, connectionHandle)
{
new szMessage[201];
switch(resultid)
{
case THREAD_USERNAME_LOOKUP:
{
mysql_store_result(connectionHandle);
if(mysql_num_rows(connectionHandle) > 0)
{
mysql_retrieve_row();
new szValue[64];
mysql_fetch_field_row(PlayerInfo[extraid][pPassword], "Password", connectionHandle);
mysql_fetch_field_row(szValue, "Id", connectionHandle); PlayerInfo[extraid][pId] = strval(szValue);
PlayerInfo[extraid][pStatus] = 2;
mysql_free_result(connectionHandle);
format(szMessage, sizeof(szMessage), "\t{FFFFFF}Welcome to {7A5DC7}"SERVER_NAME"{FFFFFF}!\n\nHello %s, this account appears to be {FF0000}registered!\n{FFFFFF}Please type in the correct password to access this account:", PlayerInfo[extraid][pUsername]);
ShowPlayerDialog(extraid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Account - Login", szMessage, "Login", "Cancel");
}
else
{
if(!IsRPName(extraid))
{
SendClientMessage(extraid, COLOR_WHITE, "You do not have a roleplay name! Rejoin with a roleplay name!");
SendClientMessage(extraid, COLOR_WHITE, "Example: Jillian_Porter");
return Kick(extraid);
}
else
{
PlayerInfo[extraid][pStatus] = 2;
format(szMessage, sizeof(szMessage), "\t{FFFFFF}Welcome to {7A5DC7}"SERVER_NAME"{FFFFFF}!\n\nHello %s, this account appears to be {00FF1E}available!\n{FFFFFF}Please type in a valid password to register this account:", PlayerInfo[extraid][pUsername]);
ShowPlayerDialog(extraid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Account - Registration", szMessage, "Register", "Exit");
}
}
}
case THREAD_USERNAME_REGISTER:
{
PlayerInfo[extraid][pId] = mysql_insert_id(iConnectionHandle);
RegisterPlayerAccount(extraid);
}
case THREAD_LOAD_PLAYER:
{
mysql_store_result(connectionHandle);
mysql_retrieve_row();
new szValue[64];
mysql_fetch_field_row(szValue, "Skin", connectionHandle); PlayerInfo[extraid][pSkin] = strval(szValue);
mysql_fetch_field_row(szValue, "PositionX", connectionHandle); PlayerInfo[extraid][pPos][0] = floatstr(szValue);
mysql_fetch_field_row(szValue, "PositionY", connectionHandle); PlayerInfo[extraid][pPos][1] = floatstr(szValue);
mysql_fetch_field_row(szValue, "PositionZ", connectionHandle); PlayerInfo[extraid][pPos][2] = floatstr(szValue);
mysql_fetch_field_row(szValue, "PositionA", connectionHandle); PlayerInfo[extraid][pPos][3] = floatstr(szValue);
mysql_free_result(connectionHandle);
SendClientMessage(extraid, COLOR_YELLOW, "You have now logged in to the server.");
SetSpawnInfo(extraid, 0, PlayerInfo[extraid][pSkin], PlayerInfo[extraid][pPos][0], PlayerInfo[extraid][pPos][1], PlayerInfo[extraid][pPos][2], PlayerInfo[extraid][pPos][3], 0, 0, 0, 0, 0, 0);
SpawnPlayer(extraid);
}
case THREAD_REGISTER_PLAYER:
{
PlayerInfo[extraid][pPos][0] = 1743.0;
PlayerInfo[extraid][pPos][1] = -1864.0;
PlayerInfo[extraid][pPos][2] = 14.0;
PlayerInfo[extraid][pPos][3] = 356.0;
PlayerInfo[extraid][pSkin] = 299;
PlayerInfo[extraid][pStatus] = 1;
SetSpawnInfo(extraid, 0, PlayerInfo[extraid][pSkin], PlayerInfo[extraid][pPos][0], PlayerInfo[extraid][pPos][1], PlayerInfo[extraid][pPos][2], PlayerInfo[extraid][pPos][3], 0, 0, 0, 0, 0, 0);
SpawnPlayer(extraid);
}
case THREAD_NO_RESULT:
{
}
}
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
//-------------------------------------------[Removing Vending Machines]-----------------------------
RemoveBuildingForPlayer(playerid, 956, 1634.1487,-2238.2810,13.5077, 20.0); //Snack vender @ LS Airport
RemoveBuildingForPlayer(playerid, 956, 2480.9885,-1958.5117,13.5831, 20.0); //Snack vender @ Sushi Shop in Willowfield
RemoveBuildingForPlayer(playerid, 955, 1729.7935,-1944.0087,13.5682, 20.0); //Sprunk machine @ Unity Station
RemoveBuildingForPlayer(playerid, 955, 2060.1099,-1898.4543,13.5538, 20.0); //Sprunk machine opposite Tony's Liqour in Willowfield
RemoveBuildingForPlayer(playerid, 955, 2325.8708,-1645.9584,14.8270, 20.0); //Sprunk machine @ Ten Green Bottles
RemoveBuildingForPlayer(playerid, 955, 1153.9130,-1460.8893,15.7969, 20.0); //Sprunk machine @ Market
RemoveBuildingForPlayer(playerid, 955,1788.3965,-1369.2336,15.7578, 20.0); //Sprunk machine in Downtown Los Santos
RemoveBuildingForPlayer(playerid, 955, 2352.9939,-1357.1105,24.3984, 20.0); //Sprunk machine @ Liquour shop in East Los Santos
RemoveBuildingForPlayer(playerid, 1775, 2224.3235,-1153.0692,1025.7969, 20.0); //Sprunk machine @ Jefferson Motel
RemoveBuildingForPlayer(playerid, 956, 2140.2566,-1161.7568,23.9922, 20.0); //Snack machine @ pick'n'go market in Jefferson
RemoveBuildingForPlayer(playerid, 956, 2154.1199,-1015.7635,62.8840, 20.0); //Snach machine @ Carniceria El Pueblo in Las Colinas
RemoveBuildingForPlayer(playerid, 956, 662.5665,-551.4142,16.3359, 20.0); //Snack vender at Dillimore Gas Station
RemoveBuildingForPlayer(playerid, 955, 200.2010,-107.6401,1.5513, 20.0); //Sprunk machine @ Blueberry Safe House
RemoveBuildingForPlayer(playerid, 956, 2271.4666,-77.2104,26.5824, 20.0); //Snack machine @ Palomino Creek Library
RemoveBuildingForPlayer(playerid, 955, 1278.5421,372.1057,19.5547, 20.0); //Sprunk machine @ Papercuts in Montgomery
RemoveBuildingForPlayer(playerid, 955, 1929.5527,-1772.3136,13.5469, 20.0); //Sprunk machine @ Idlewood Gas Station
RemoveBuildingForPlayer(playerid, 1302, -2419.5835,984.4185,45.2969, 20.0); //Soda machine 1 @ Juniper Hollow Gas Station
RemoveBuildingForPlayer(playerid, 1209, -2419.5835,984.4185,45.2969, 20.0); //Soda machine 2 @ Juniper Hollow Gas Station
RemoveBuildingForPlayer(playerid, 956, -2229.2075,287.2937,35.3203, 20.0); //Snack vender @ King's Car Park
RemoveBuildingForPlayer(playerid, 955, -1349.3947,493.1277,11.1953, 20.0); //Sprunk machine @ SF Aircraft Carrier
RemoveBuildingForPlayer(playerid, 956, -1349.3947,493.1277,11.1953, 20.0); //Snack vender @ SF Aircraft Carrier
RemoveBuildingForPlayer(playerid, 955, -1981.6029,142.7232,27.6875, 20.0); //Sprunk machine @ Cranberry Station
RemoveBuildingForPlayer(playerid, 955, -2119.6245,-422.9411,35.5313, 20.0); //Sprunk machine 1/2 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2097.3696,-397.5220,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2068.5593,-397.5223,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2039.8802,-397.5214,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2011.1403,-397.5225,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2005.7861,-490.8688,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2034.5267,-490.8681,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2063.1875,-490.8687,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2091.9780,-490.8684,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 956, -1455.1298,2592.4138,55.8359, 20.0); //Snack vender @ El Quebrados GONE
RemoveBuildingForPlayer(playerid, 955, -252.9574,2598.9048,62.8582, 20.0); //Sprunk machine @ Las Payasadas GONE
RemoveBuildingForPlayer(playerid, 956, -252.9574,2598.9048,62.8582, 20.0); //Snack vender @ Las Payasadas GONE
RemoveBuildingForPlayer(playerid, 956, 1398.7617,2223.3606,11.0234, 20.0); //Snack vender @ Redsands West GONE
RemoveBuildingForPlayer(playerid, 955, -862.9229,1537.4246,22.5870, 20.0); //Sprunk machine @ The Smokin' Beef Grill in Las Barrancas GONE
RemoveBuildingForPlayer(playerid, 955, -14.6146,1176.1738,19.5634, 20.0); //Sprunk machine @ Fort Carson GONE
RemoveBuildingForPlayer(playerid, 956, -75.2839,1227.5978,19.7360, 20.0); //Snack vender @ Fort Carson GONE
RemoveBuildingForPlayer(playerid, 955, 1519.3328,1055.2075,10.8203, 20.0); //Sprunk machine @ LVA Freight Department GONE
RemoveBuildingForPlayer(playerid, 956, 1659.5096,1722.1096,10.8281, 20.0); //Snack vender near Binco @ LV Airport GONE
RemoveBuildingForPlayer(playerid, 955, 2086.5872,2071.4958,11.0579, 20.0); //Sprunk machine @ Sex Shop on The Strip
RemoveBuildingForPlayer(playerid, 955, 2319.9001,2532.0376,10.8203, 20.0); //Sprunk machine @ Pizza co by Julius Thruway (North)
RemoveBuildingForPlayer(playerid, 955, 2503.2061,1244.5095,10.8203, 20.0); //Sprunk machine @ Club in the Camels Toe
RemoveBuildingForPlayer(playerid, 956, 2845.9919,1294.2975,11.3906, 20.0); //Snack vender @ Linden Station
RemoveBuildingForPlayer(playerid, 1775, 496.0843,-23.5310,1000.6797, 20.0); //Sprunk machine 1 @ Club in Camels Toe
RemoveBuildingForPlayer(playerid, 1775, 501.1219,-2.1968,1000.6797, 20.0); //Sprunk machine 2 @ Club in Camels Toe
RemoveBuildingForPlayer(playerid, 1776, 501.1219,-2.1968,1000.6797, 20.0); //Snack vender @ Club in Camels Toe
RemoveBuildingForPlayer(playerid, 1775, -19.2299,-57.0460,1003.5469, 20.0); //Sprunk machine @ Roboi's type 24/7 stores
RemoveBuildingForPlayer(playerid, 1776, -35.9012,-57.1345,1003.5469, 20.0); //Snack vender @ Roboi's type 24/7 stores
RemoveBuildingForPlayer(playerid, 1775, -17.0036,-90.9709,1003.5469, 20.0); //Sprunk machine @ Other 24/7 stores
RemoveBuildingForPlayer(playerid, 1776, -17.0036,-90.9709,1003.5469, 20.0); //Snach vender @ Others 24/7 stores
//-----------------------------------[Removed Vending Machines]
ResetPlayerInfo(playerid);
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Welcome to " SERVER_NAME ".");
new szQuery[128];
TogglePlayerSpectating(playerid, 1);
format(szQuery, sizeof(szQuery), "SELECT * FROM players WHERE Username = '%s'", PlayerInfo[playerid][pUsername]);
mysql_query(szQuery, THREAD_USERNAME_LOOKUP, playerid, iConnectionHandle);
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SavePlayerAccount(playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
return SendClientMessage(playerid, COLOR_WHITE, "Invalid command! Type /cmds for a list of commands!");
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new szMessage[201];
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
if(strlen(inputtext) > MAX_PASSWORD_LENGTH || strlen(inputtext) < MIN_PASSWORD_LENGTH)
{
format(szMessage, sizeof(szMessage), "SERVER: Your password must be under %d and above %d characters.", MAX_PASSWORD_LENGTH, MIN_PASSWORD_LENGTH);
SendClientMessage(playerid, COLOR_GREY, szMessage);
format(szMessage, sizeof(szMessage), "\t{FFFFFF}Welcome to {7A5DC7}"SERVER_NAME"{FFFFFF}!\n\nHello %s, this account appears to be {00FF1E}available!\n{FFFFFF}Please type in a valid password to register this account:", PlayerInfo[playerid][pUsername]);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Account - Registration", szMessage, "Register", "Exit");
}
else
{
new szQuery[256];
WP_Hash(PlayerInfo[playerid][pPassword], 129, inputtext);
format(szQuery, sizeof(szQuery), "INSERT INTO players (Username, Password) VALUES ('%s', '%s')", PlayerInfo[playerid][pUsername], PlayerInfo[playerid][pPassword]);
mysql_query(szQuery, THREAD_USERNAME_REGISTER, playerid, iConnectionHandle);
}
}
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
new HashedPassword[129];
WP_Hash(HashedPassword, 129, inputtext);
if(!strcmp(PlayerInfo[playerid][pPassword], HashedPassword, true, 128))
{
PlayerInfo[playerid][pStatus] = 1;
LoginPlayerAccount(playerid);
}
else
{
SetPVarInt(playerid, "IPA", GetPVarInt(playerid, "IPA") + 1);
if(GetPVarInt(playerid, "IPA") == MAX_INCORRECT_PASSWORD_ATTEMPTS)
{
SendClientMessage(playerid, COLOR_RED, "You have entered an incorrect password too many times. You'll be kicked now.");
Kick(playerid);
printf("%s has been kicked for reaching %d failed login attempts.", PlayerInfo[playerid][pUsername], MAX_INCORRECT_PASSWORD_ATTEMPTS);
}
else
{
format(szMessage, sizeof(szMessage), "You have %d attempts left before you're kicked.", MAX_INCORRECT_PASSWORD_ATTEMPTS - GetPVarInt(playerid, "IPA"));
SendClientMessage(playerid, COLOR_RED, szMessage);
format(szMessage, sizeof(szMessage), "\t{FFFFFF}Welcome to {7A5DC7}"SERVER_NAME"{FFFFFF}!\n\n{FFFFFF}Hello %s, this account appears to be {FF0000}registered!\n{FFFFFF}Please type in the correct password to access this account:", PlayerInfo[playerid][pUsername]);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", szMessage, "Login", "Cancel");
}
}
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock RegisterPlayerAccount(playerid)
{
new szQuery[264];
format(szQuery, sizeof(szQuery), "UPDATE `players` SET PositionX = 1742.9979, PositionY = -1864.3871, PositionZ = 13.5739, PositionA = 356.1204, Skin = 299 WHERE Username = '%s'", PlayerInfo[playerid][pUsername]);
mysql_query(szQuery, THREAD_REGISTER_PLAYER, playerid, iConnectionHandle);
return 1;
}
stock LoginPlayerAccount(playerid)
{
new szQuery[128];
format(szQuery, sizeof(szQuery), "SELECT * FROM players WHERE Username = '%s'", PlayerInfo[playerid][pUsername]);
mysql_query(szQuery, THREAD_LOAD_PLAYER, playerid, iConnectionHandle);
return 1;
}
stock SavePlayerAccount(playerid)
{
new szQuery[300], Float:Health, Float:Armour;
if(PlayerInfo[playerid][pStatus] != 1) return 1;
GetPlayerHealth(playerid, Health);
GetPlayerArmour(playerid, Armour);
GetPlayerPos(playerid, PlayerInfo[playerid][pPos][0], PlayerInfo[playerid][pPos][1], PlayerInfo[playerid][pPos][2]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pPos][3]);
format(szQuery, sizeof(szQuery), "UPDATE `players` SET Health = %f, Armour = %f, PositionX = %f, PositionY = %f, PositionZ = %f, PositionA = %f, Skin = %d WHERE Username = '%s'", Health, Armour, PlayerInfo[playerid][pPos][0], PlayerInfo[playerid][pPos][1], PlayerInfo[playerid][pPos][2], PlayerInfo[playerid][pPos][3], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pUsername]);
mysql_query(szQuery, THREAD_NO_RESULT, "", iConnectionHandle);
return 1;
}
stock IsRPName(playerid, max_underscores = 2)
{
new underscores = 0, name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
if (name[0] < 'A' || name[0] > 'Z') return false;
for(new i = 1; i < strlen(name); i++)
{
if(name[i] != '_' && (name[i] < 'A' || name[i] > 'Z') && (name[i] < 'a' || name[i] > 'z')) return false;
if( (name[i] >= 'A' && name[i] <= 'Z') && (name[i - 1] != '_') ) return false;
if(name[i] == '_')
{
underscores++;
if(underscores > max_underscores || i == strlen(name)) return false;
if(name[i + 1] < 'A' || name[i + 1] > 'Z') return false;
}
}
if (underscores == 0) return false;
return true;
}
stock ResetPlayerInfo(playerid)
{
GetPlayerName(playerid, PlayerInfo[playerid][pUsername], MAX_PLAYER_NAME);
PlayerInfo[playerid][pId] = 0;
PlayerInfo[playerid][pPos][0] = 0.00;
PlayerInfo[playerid][pPos][1] = 0.00;
PlayerInfo[playerid][pPos][2] = 0.00;
PlayerInfo[playerid][pPos][3] = 0.00;
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
PlayerInfo[playerid][pStatus] = 0;
PlayerInfo[playerid][pSkin] = 299;
return 1;
}
EDIT: I set their spawn / skin under OnPlayerSpawn as-well but he did the same thing.