23.03.2011, 18:22
Here is code and you can clearly see or test, that it`s commands doesn`t work. HELP:
pawn Код:
#include <a_samp>
#include <dini>
#include <dudb>
#include <core>
#include <float>
#include <zcmd>
#pragma unused strtok
#pragma unused ret_memcpy
enum pInfo
{
pAdminLevel,
pScore,
pCash,
pJob,
pSex,
pOrigin,
pLevel,
pAge,
pKills,
pDeaths,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
new gPlayerCitySelected[MAX_PLAYERS];
new gPlayerSpawned[MAX_PLAYERS];
new STRING_SCORE[128];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<CITIES
#define CITY_LOS_SANTOS 0
#define CITY_SAN_FIERRO 1
#define CITY_LAS_VENTURAS 2
new gPlayerCitySelection[MAX_PLAYERS];
new gPlayerHasCitySelected[MAX_PLAYERS];
new gPlayerLastCitySelectionTick[MAX_PLAYERS];
new Text:txtClassSelHelper;
new Text:txtLosSantos;
new Text:txtSanFierro;
new Text:txtLasVenturas;
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define SERVER_USER_FILE "Info/Accounts/%s.ini"
#define COLOR_MESSAGE 0x00C7FFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFF0088
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_GREEN2 0x33FF33AA
#define COLOR_ERROR 0xFF0000AA
#define COLOR_MSG 0x00FFFFFF
#define COLOR_PINK 0xFF66FFAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_GREEN1 0x33AA33AA
#define COLOR_BROWN 0xA52A2AAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_BLACK 0x000000AA
#define COLOR_GREEN1 0x33AA33AA
#define DIALOG_STATS (154323)
forward UpdateTime(playerid);
new Update;
#if defined FILTERSCRIPT
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
EnableStuntBonusForAll(0);
ShowPlayerMarkers(1);
SetGameModeText("BRP 0.1");
ClassSel_InitTextDraws();
AddPlayerClass(0,-1478.1591796875,2641.5615234375,58.787948608398,225.0,0,0,0,0,0,0);
//Converted objects and vehicles below!
AddStaticVehicleEx(514,-1300.11816406,2711.66894531,50.76217651,183.99902344,-1,-1,60); //Tanker
AddStaticVehicleEx(515,-1307.83374023,2707.39941406,51.21622086,184.00000000,-1,-1,60); //Roadtrain
AddStaticVehicleEx(467,-1292.38269043,2717.24462891,49.93249893,184.00000000,23,23,60); //Oceanic
AddStaticVehicleEx(467,-1288.60168457,2719.40747070,49.93249893,183.99902344,84,84,60); //Oceanic
AddStaticVehicleEx(599,-1400.21374512,2631.59326172,56.15375137,90.00000000,-1,-1,60); //Police Ranger
AddStaticVehicleEx(599,-1400.21374512,2637.70703125,56.07262802,90.00000000,-1,-1,60); //Police Ranger
AddStaticVehicleEx(599,-1400.21374512,2643.94165039,56.07262802,90.00000000,-1,-1,60); //Police Ranger
AddStaticVehicleEx(599,-1400.21374512,2650.30273438,56.07262802,90.00000000,-1,-1,60); //Police Ranger
AddStaticVehicleEx(599,-1400.21374512,2656.56591797,56.07262802,90.00000000,-1,-1,60); //Police Ranger
AddStaticVehicleEx(416,-1525.40270996,2526.62670898,56.05318069,0.00000000,1,86,60); //Ambulance
AddStaticVehicleEx(416,-1503.75781250,2526.62670898,55.98707581,0.00000000,1,86,60); //Ambulance
AddStaticVehicleEx(418,-1555.80578613,2699.56909180,56.01889420,180.00000000,-1,-1,60); //Moonbeam
AddStaticVehicleEx(422,-1562.96313477,2706.36816406,55.91593933,180.00000000,61,61,60); //Bobcat
AddStaticVehicleEx(478,-1596.38085938,2695.55053711,55.00576019,180.00000000,-1,-1,60); //Walton
AddStaticVehicleEx(462,-1565.87597656,2647.39599609,55.50615692,270.00000000,69,69,60); //Faggio
AddStaticVehicleEx(463,-1589.01342773,2655.27587891,55.47562790,0.00000000,115,1,60); //Freeway
AddStaticVehicleEx(586,-1515.61560059,2569.81079102,55.43293762,0.00000000,19,19,60); //Wayfarer
AddStaticVehicleEx(481,-1448.43811035,2563.34326172,55.44471359,0.00000000,-1,-1,60); //BMX
AddStaticVehicleEx(481,-1446.35791016,2563.34326172,55.44471359,0.00000000,-1,-1,60); //BMX
AddStaticVehicleEx(405,-1476.19897461,2694.07080078,55.76825714,180.00000000,7,1,60); //Sentinel
AddStaticVehicleEx(516,487.10317993,-1513.49951172,20.19931412,4.24548340,-1,-1,60); //Nebula
AddStaticVehicleEx(516,489.10848999,-1485.42517090,19.66974640,346.99072266,-1,-1,60); //Nebula
AddStaticVehicleEx(585,486.79458618,-1470.94604492,18.56768227,156.99975586,-1,-1,60); //Emperor
AddStaticVehicleEx(585,483.21176147,-1528.78674316,19.41002274,195.49444580,-1,-1,60); //Emperor
AddStaticVehicleEx(529,493.05395508,-1551.93518066,17.42130089,214.00000000,-1,-1,60); //Willard
AddStaticVehicleEx(529,497.94583130,-1462.73864746,17.38317490,331.50000000,-1,-1,60); //Willard
AddStaticVehicleEx(507,2044.16235352,1912.56884766,12.09379768,0.75000000,-1,-1,60); //Elegant
AddStaticVehicleEx(507,2044.37866211,1925.68713379,12.09483242,356.99707031,-1,-1,60); //Elegant
AddStaticVehicleEx(507,2044.84924316,1898.95288086,12.02051544,5.74707031,-1,-1,60); //Elegant
AddStaticVehicleEx(492,2052.93920898,1877.56762695,11.62965298,270.50000000,-1,-1,60); //Greenwood
AddStaticVehicleEx(492,2053.20800781,1955.01660156,11.61928177,89.25000000,-1,-1,60); //Greenwood
CreateObject(1506,-1390.78222656,2639.35546875,54.98437500,0.00000000,0.00000000,0.00000000); //object(gen_doorext08) (1)
CreateObject(3861,-1513.59326172,2612.11938477,55.95486450,0.00000000,0.00000000,0.00000000); //object(marketstall01_sfxrf) (1)
CreateObject(3862,-1524.15332031,2585.33886719,56.00827026,0.00000000,0.00000000,179.99450684); //object(marketstall02_sfxrf) (1)
CreateObject(3863,-1520.79003906,2585.33886719,56.00827026,0.00000000,0.00000000,179.99450684); //object(marketstall03_sfxrf) (1)
CreateObject(1514,-1514.54589844,2611.55346680,55.86582565,0.00000000,0.00000000,330.00000000); //object(dyn_ff_till) (2)
CreateObject(1514,-1521.74707031,2585.92968750,55.91923141,0.00000000,0.00000000,209.99816895); //object(dyn_ff_till) (3)
CreateObject(1514,-1523.20410156,2585.92968750,55.91923141,0.00000000,0.00000000,149.99633789); //object(dyn_ff_till) (4)
CreateObject(2184,-1480.23144531,2642.69335938,57.78794861,0.00000000,0.00000000,293.99963379); //object(med_office6_desk_2) (2)
CreateObject(2184,-1478.75878906,2640.14941406,57.78794861,0.00000000,0.00000000,336.99462891); //object(med_office6_desk_2) (3)
CreateObject(2190,-1477.39685059,2639.84277344,58.56368637,0.00000000,0.00000000,174.75000000); //object(pc_1) (3)
CreateObject(2894,-1478.02453613,2640.68750000,58.56368637,0.00000000,0.00000000,138.00000000); //object(kmb_rhymesbook) (1)
CreateObject(1710,-1476.98217773,2635.64379883,57.78794861,0.00000000,0.00000000,270.00000000); //object(kb_couch07) (1)
CreateObject(3040,-1522.49780273,2589.35009766,57.26776886,0.00000000,0.00000000,90.00000000); //object(ct_stall2) (1)
CreateObject(18038,-1518.18359375,2620.04394531,10.01234436,0.00000000,0.00000000,270.00000000); //object(gun-shop-vegas) (1)
CreateObject(2946,-1533.49719238,2637.23510742,7.78578186,0.00000000,0.00000000,0.00000000); //object(cr_door_03) (4)
CreateObject(2946,-1533.49548340,2640.41503906,7.78578186,0.00000000,0.00000000,180.00000000); //object(cr_door_03) (5)
CreateObject(2946,-1505.93627930,2616.12646484,54.83593750,0.00000000,0.00000000,0.00000000); //object(cr_door_03) (6)
CreateObject(2946,-1505.93627930,2619.29980469,54.83593750,0.00000000,0.00000000,180.00000000); //object(cr_door_03) (7)
CreateObject(983,-1472.78027344,2611.17285156,58.47150421,0.00000000,0.00000000,90.00000000); //object(fenceshit3) (1)
CreateObject(14603,-1383.76855469,2641.46875000,33.28429031,0.00000000,0.00000000,270.00000000); //object(bikeschl_main) (1)
CreateObject(1506,-1388.51367188,2641.59667969,31.50304031,0.00000000,0.00000000,90.00000000); //object(gen_doorext08) (1)
CreateObject(1216,478.78381348,-1495.53796387,20.09435844,0.00000000,0.00000000,2.00000000); //object(phonebooth1) (2) los_santos
CreateObject(1216,2026.36706543,1896.48400879,11.93183136,0.00000000,0.00000000,180.00000000); //object(phonebooth1) (3) las_venturas
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
new name[MAX_PLAYER_NAME], file[256];
//--------------------------------------------------------------------------
new String_Connected[64];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
format(String_Connected,sizeof String_Connected,"%s Has Joined The Server",name);
SendClientMessageToAll(COLOR_RED,String_Connected);
//--------------------------------------------------------------------------
gPlayerLogged[playerid] = 0;
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),SERVER_USER_FILE,name);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register/Login:","You Are Not Registered, Write Your Password Below", "Register", "Leave");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Register/Login:","You Are Registered, Write Your Password Below To Login", "Login", "Leave");
}
return 1;
}
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)
{
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
dini_IntSet(file, "Score", GetPlayerScore(playerid));
dini_IntSet(file, "Respect", GetPVarInt(playerid, "RESP"));
dini_IntSet(file, "Money", GetPlayerMoney(playerid));//PlayerInfo[playerid][pCash]
dini_IntSet(file, "Job", PlayerInfo[playerid][pJob]);
dini_IntSet(file, "Sex",PlayerInfo[playerid][pSex]);
dini_IntSet(file, "Origin",PlayerInfo[playerid][pOrigin]);
dini_IntSet(file, "Age",PlayerInfo[playerid][pAge]);
dini_IntSet(file, "Level",PlayerInfo[playerid][pLevel]);
//dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills]);
dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths]);
dini_IntSet(file, "Kills", GetPVarInt(playerid, "Kills"));
dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths"));
dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));
KillTimer(Update);
}
gPlayerLogged[playerid] = 0;
gPlayerCitySelected[playerid] = 0;
//--------------------------------------------------------------------------
new String_Leaving[64];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(String_Leaving,sizeof String_Leaving,"%s Has Left The Server. (Timed out)",name);
case 1: format(String_Leaving,sizeof String_Leaving,"%s Has Left The Server. (Leaving)",name);
case 2: format(String_Leaving,sizeof String_Leaving,"%s Has Left The Server. (Kicked/Banned)",name);
}
SendClientMessageToAll(COLOR_RED,String_Leaving);
//--------------------------------------------------------------------------
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid)) return 1;
if(gPlayerLogged[playerid] == 1)
{
if(gPlayerHasCitySelected[playerid])
{
ClassSel_SetupCharSelection(playerid);
return 1;
}
else
{
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
TogglePlayerSpectating(playerid,1);
TextDrawShowForPlayer(playerid, txtClassSelHelper);
gPlayerCitySelection[playerid] = -1;
}
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
gPlayerSpawned[playerid] = 1;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<CITIES
gPlayerHasCitySelected[playerid] = 0;
if(CITY_LOS_SANTOS == gPlayerCitySelection[playerid])
{
gPlayerCitySelected[playerid] = 1;
}
else if(CITY_SAN_FIERRO == gPlayerCitySelection[playerid])
{
gPlayerCitySelected[playerid] = 2;
}
else if(CITY_LAS_VENTURAS == gPlayerCitySelection[playerid])
{
gPlayerCitySelected[playerid] = 3;
}
//------------------------------------------------------------------------------
if(gPlayerCitySelected[playerid] == 1)//Los Santos
{
SetPlayerPos(playerid,477.34484863281,-1498.9730224609,20.483509063721);
SetPlayerFacingAngle(playerid,260);
}
if(gPlayerCitySelected[playerid] == 2)//San Fierro
{
SetPlayerPos(playerid,-1968.7609863281,162.18864440918,27.6875);
SetPlayerFacingAngle(playerid,180);
}
if(gPlayerCitySelected[playerid] == 3)//Las Venturas
{
SetPlayerPos(playerid,2018.2209472656,1912.9132080078,12.321389198303);
SetPlayerFacingAngle(playerid,270);
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SetCameraBehindPlayer(playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
new file[256];
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Deaths", GetPVarInt(playerid, "Deaths")+1);
}
SendDeathMessage(killerid, playerid, reason);
gPlayerSpawned[playerid] = 0;
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if (strcmp(cmd, "/kill", true) == 0)
{
SetPlayerHealth(playerid,0);
SendClientMessage(playerid, 0xFFFF0088, "You Died");
return 1;
}
if (strcmp(cmd, "/stats", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (gPlayerLogged[playerid] != 0)
{
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_MSGBOX ,"Test","test:","ok","");
}
else
{
SendClientMessage(playerid, COLOR_RED, "Вы не авторизовались!");
}
}
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public UpdateTime(playerid)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),SERVER_USER_FILE,name);
format(file, 128, "/Business_RolePlay/Players/%s.ini",name);
SetPVarInt(playerid, "Time", GetPVarInt(playerid, "Time")+1);
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)
{
new TIME_STRING[256];
new RESPECT_STRING[256];
//new file[256];
// newfile[256];
if (gPlayerSpawned[playerid] == 1)
{
//Minutes In Game:
format(TIME_STRING, sizeof(TIME_STRING), "%d", GetPVarInt(playerid, "Time"));
//Score:
format(STRING_SCORE, sizeof(STRING_SCORE), "%d", GetPlayerScore(playerid));
//Respect:
format(RESPECT_STRING, sizeof(RESPECT_STRING), "%d", GetPVarInt(playerid, "RESP"));
}
if( !gPlayerHasCitySelected[playerid] &&
GetPlayerState(playerid) == PLAYER_STATE_SPECTATING ) {
ClassSel_HandleCitySelection(playerid);
return 1;
}
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[])
{
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, "Register/Login:","You Are Not Registered, Write Your 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, "Respect",GetPVarInt(playerid, "RESP"));
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 100);
dini_IntSet(file, "Job",PlayerInfo[playerid][pJob] = 0);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
dini_IntSet(file, "Sex",PlayerInfo[playerid][pSex] = 0);
dini_IntSet(file, "Origin",PlayerInfo[playerid][pOrigin] = 0);
dini_IntSet(file, "Age",PlayerInfo[playerid][pAge] = 0);
dini_IntSet(file, "Level",PlayerInfo[playerid][pLevel] = 0);
dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills] = 0);
dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0);
dini_IntSet(file, "Minutes Ingame", GetPVarInt(playerid, "Time"));
format(string, 128, "::You succesfully registered the nickname %s with password %s.::", name, inputtext);
SendClientMessage(playerid, COLOR_YELLOW, string);
gPlayerLogged[playerid] = 1;
//----------------------------------------------------------------------
ShowPlayerDialog(playerid, 14, DIALOG_STYLE_LIST, "Choose Your Sex", "Male \nFemale", "Continue", "Quit");
//----------------------------------------------------------------------
}
if (dialogid == 2)
{
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,2,DIALOG_STYLE_INPUT, "Register/Login:","You Are Registered, Write Your Password Below To Login","Login","Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid,COLOR_RED, "Wrong Password.");
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Register/Login:","You Are Registered, Write Your Password Below To Login","Login","Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPVarInt(playerid, "RESP", dini_Int(file, "Respect"));
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
//------------------------------------------------------------------
PlayerInfo[playerid][pJob] = dini_Int(file, "Job");
PlayerInfo[playerid][pSex] = dini_Int(file, "Sex");
PlayerInfo[playerid][pOrigin] = dini_Int(file, "Origin");
PlayerInfo[playerid][pAge] = dini_Int(file, "Age");
PlayerInfo[playerid][pLevel] = dini_Int(file, "Level");
PlayerInfo[playerid][pKills] = dini_Int(file, "Kills");
PlayerInfo[playerid][pDeaths] = dini_Int(file, "Deaths");
SetPVarInt(playerid, "Time", dini_Int(file, "Minutes Ingame"));
Update = SetTimerEx("UpdateTime", 60*1000, 1, "i", playerid);
//------------------------------------------------------------------
SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: Successfully logged in!");
}
}
if(dialogid == 14)
{
if(response)
{
new message[256+1];
if(listitem == 0)
{
format(message, 256, "::You are male::", listitem);
SendClientMessage(playerid, COLOR_YELLOW, message);
//------------------------------------------------------------------
if(gPlayerHasCitySelected[playerid])
{
ClassSel_SetupCharSelection(playerid);
return 1;
}
else
{
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
TogglePlayerSpectating(playerid,1);
TextDrawShowForPlayer(playerid, txtClassSelHelper);
gPlayerCitySelection[playerid] = -1;
}
}
//------------------------------------------------------------------
}
if(listitem == 1)
{
format(message, 256, "::You are female::", listitem);
SendClientMessage(playerid, COLOR_YELLOW, message);
//------------------------------------------------------------------
if(gPlayerHasCitySelected[playerid])
{
ClassSel_SetupCharSelection(playerid);
return 1;
}
else
{
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
TogglePlayerSpectating(playerid,1);
TextDrawShowForPlayer(playerid, txtClassSelHelper);
gPlayerCitySelection[playerid] = -1;
}
}
//------------------------------------------------------------------
return 1;
}
}
if (dialogid == DIALOG_STATS)
{
if (response == 1)
{
//Nothing
}
else
{
//Nothing
}
return 1;
}
}
return 0;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<CITIES
ClassSel_InitTextDraws()
{
// Init our observer helper text display
txtLosSantos = TextDrawCreate(10.0, 380.0, "Los Santos");
ClassSel_InitCityNameText(txtLosSantos);
txtSanFierro = TextDrawCreate(10.0, 380.0, "San Fierro");
ClassSel_InitCityNameText(txtSanFierro);
txtLasVenturas = TextDrawCreate(10.0, 380.0, "Las Venturas");
ClassSel_InitCityNameText(txtLasVenturas);
// Init our observer helper text display
txtClassSelHelper = TextDrawCreate(10.0, 415.0,
" Press ~b~~k~~GO_LEFT~ ~w~or ~b~~k~~GO_RIGHT~ ~w~to switch cities.~n~ Press ~r~~k~~PED_FIREWEAPON~ ~w~to select.");
TextDrawUseBox(txtClassSelHelper, 1);
TextDrawBoxColor(txtClassSelHelper,0x222222BB);
TextDrawLetterSize(txtClassSelHelper,0.3,1.0);
TextDrawTextSize(txtClassSelHelper,400.0,40.0);
TextDrawFont(txtClassSelHelper, 2);
TextDrawSetShadow(txtClassSelHelper,0);
TextDrawSetOutline(txtClassSelHelper,1);
TextDrawBackgroundColor(txtClassSelHelper,0x000000FF);
TextDrawColor(txtClassSelHelper,0xFFFFFFFF);
}
ClassSel_SetupSelectedCity(playerid)
{
if(gPlayerCitySelection[playerid] == -1) {
gPlayerCitySelection[playerid] = CITY_LOS_SANTOS;
}
if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) {
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,1630.6136,-2286.0298,110.0);
SetPlayerCameraLookAt(playerid,1887.6034,-1682.1442,47.6167);
TextDrawShowForPlayer(playerid,txtLosSantos);
TextDrawHideForPlayer(playerid,txtSanFierro);
TextDrawHideForPlayer(playerid,txtLasVenturas);
}
else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) {
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,-1300.8754,68.0546,129.4823);
SetPlayerCameraLookAt(playerid,-1817.9412,769.3878,132.6589);
TextDrawHideForPlayer(playerid,txtLosSantos);
TextDrawShowForPlayer(playerid,txtSanFierro);
TextDrawHideForPlayer(playerid,txtLasVenturas);
}
else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) {
SetPlayerInterior(playerid,0);
SetPlayerCameraPos(playerid,1310.6155,1675.9182,110.7390);
SetPlayerCameraLookAt(playerid,2285.2944,1919.3756,68.2275);
TextDrawHideForPlayer(playerid,txtLosSantos);
TextDrawHideForPlayer(playerid,txtSanFierro);
TextDrawShowForPlayer(playerid,txtLasVenturas);
}
}
ClassSel_SwitchToNextCity(playerid)
{
gPlayerCitySelection[playerid]++;
if(gPlayerCitySelection[playerid] > CITY_LAS_VENTURAS) {
gPlayerCitySelection[playerid] = CITY_LOS_SANTOS;
}
PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
gPlayerLastCitySelectionTick[playerid] = GetTickCount();
ClassSel_SetupSelectedCity(playerid);
}
ClassSel_SwitchToPreviousCity(playerid)
{
gPlayerCitySelection[playerid]--;
if(gPlayerCitySelection[playerid] < CITY_LOS_SANTOS) {
gPlayerCitySelection[playerid] = CITY_LAS_VENTURAS;
}
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
gPlayerLastCitySelectionTick[playerid] = GetTickCount();
ClassSel_SetupSelectedCity(playerid);
}
ClassSel_HandleCitySelection(playerid)
{
new Keys,ud,lr;
GetPlayerKeys(playerid,Keys,ud,lr);
if(gPlayerCitySelection[playerid] == -1) {
ClassSel_SwitchToNextCity(playerid);
return;
}
// only allow new selection every ~500 ms
if( (GetTickCount() - gPlayerLastCitySelectionTick[playerid]) < 500 ) return;
if(Keys & KEY_FIRE)
{
gPlayerHasCitySelected[playerid] = 1;
TextDrawHideForPlayer(playerid,txtClassSelHelper);
TextDrawHideForPlayer(playerid,txtLosSantos);
TextDrawHideForPlayer(playerid,txtSanFierro);
TextDrawHideForPlayer(playerid,txtLasVenturas);
TogglePlayerSpectating(playerid,0);
return;
}
if(lr > 0) {
ClassSel_SwitchToNextCity(playerid);
}
else if(lr < 0) {
ClassSel_SwitchToPreviousCity(playerid);
}
}
ClassSel_InitCityNameText(Text:txtInit)
{
TextDrawUseBox(txtInit, 0);
TextDrawLetterSize(txtInit,1.25,3.0);
TextDrawFont(txtInit, 0);
TextDrawSetShadow(txtInit,0);
TextDrawSetOutline(txtInit,1);
TextDrawColor(txtInit,0xEEEEEEFF);
TextDrawBackgroundColor(txtClassSelHelper,0x000000FF);
}
ClassSel_SetupCharSelection(playerid)
{
if(gPlayerCitySelection[playerid] == CITY_LOS_SANTOS) {
SetPlayerInterior(playerid,11);
SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
SetPlayerFacingAngle(playerid,0.0);
SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
}
else if(gPlayerCitySelection[playerid] == CITY_SAN_FIERRO) {
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,-2673.8381,1399.7424,918.3516);
SetPlayerFacingAngle(playerid,181.0);
SetPlayerCameraPos(playerid,-2673.2776,1394.3859,918.3516);
SetPlayerCameraLookAt(playerid,-2673.8381,1399.7424,918.3516);
}
else if(gPlayerCitySelection[playerid] == CITY_LAS_VENTURAS) {
SetPlayerInterior(playerid,3);
SetPlayerPos(playerid,349.0453,193.2271,1014.1797);
SetPlayerFacingAngle(playerid,286.25);
SetPlayerCameraPos(playerid,352.9164,194.5702,1014.1875);
SetPlayerCameraLookAt(playerid,349.0453,193.2271,1014.1797);
}
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//MINUTES_INGAME
stock sscanf(string[], format[], {Float,_}:...)
{
#if defined isnull
if (isnull(string))
#else
if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
#endif
{
return format[0];
}
#pragma tabsize 4
new
formatPos = 0,
stringPos = 0,
paramPos = 2,
paramCount = numargs(),
delim = ' ';
while (string[stringPos] && string[stringPos] <= ' ')
{
stringPos++;
}
while (paramPos < paramCount && string[stringPos])
{
switch (format[formatPos++])
{
case '\0':
{
return 0;
}
case 'i', 'd':
{
new
neg = 1,
num = 0,
ch = string[stringPos];
if (ch == '-')
{
neg = -1;
ch = string[++stringPos];
}
do
{
stringPos++;
if ('0' <= ch <= '9')
{
num = (num * 10) + (ch - '0');
}
else
{
return -1;
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num * neg);
}
case 'h', 'x':
{
new
num = 0,
ch = string[stringPos];
do
{
stringPos++;
switch (ch)
{
case 'x', 'X':
{
num = 0;
continue;
}
case '0' .. '9':
{
num = (num << 4) | (ch - '0');
}
case 'a' .. 'f':
{
num = (num << 4) | (ch - ('a' - 10));
}
case 'A' .. 'F':
{
num = (num << 4) | (ch - ('A' - 10));
}
default:
{
return -1;
}
}
}
while ((ch = string[stringPos]) > ' ' && ch != delim);
setarg(paramPos, 0, num);
}
case 'c':
{
setarg(paramPos, 0, string[stringPos++]);
}
case 'f':
{
new changestr[16], changepos = 0, strpos = stringPos;
while(changepos < 16 && string[strpos] && string[strpos] != delim)
{
changestr[changepos++] = string[strpos++];
}
changestr[changepos] = '\0';
setarg(paramPos,0,_:floatstr(changestr));
}
case 'p':
{
delim = format[formatPos++];
continue;
}
case '\'':
{
new
end = formatPos - 1,
ch;
while ((ch = format[++end]) && ch != '\'') {}
if (!ch)
{
return -1;
}
format[end] = '\0';
if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
{
if (format[end + 1])
{
return -1;
}
return 0;
}
format[end] = '\'';
stringPos = ch + (end - formatPos);
formatPos = end + 1;
}
case 'u':
{
new
end = stringPos - 1,
id = 0,
bool:num = true,
ch;
while ((ch = string[++end]) && ch != delim)
{
if (num)
{
if ('0' <= ch <= '9')
{
id = (id * 10) + (ch - '0');
}
else
{
num = false;
}
}
}
if (num && IsPlayerConnected(id))
{
setarg(paramPos, 0, id);
}
else
{
#if !defined foreach
#define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
#define __SSCANF_FOREACH__
#endif
string[end] = '\0';
num = false;
new
name[MAX_PLAYER_NAME];
id = end - stringPos;
foreach (Player, playerid)
{
GetPlayerName(playerid, name, sizeof (name));
if (!strcmp(name, string[stringPos], true, id))
{
setarg(paramPos, 0, playerid);
num = true;
break;
}
}
if (!num)
{
setarg(paramPos, 0, INVALID_PLAYER_ID);
}
string[end] = ch;
#if defined __SSCANF_FOREACH__
#undef foreach
#undef __SSCANF_FOREACH__
#endif
}
stringPos = end;
}
case 's', 'z':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = string[stringPos++]) && ch != delim)
{
setarg(paramPos, i++, ch);
}
if (!i)
{
return -1;
}
}
else
{
while ((ch = string[stringPos++]))
{
setarg(paramPos, i++, ch);
}
}
stringPos--;
setarg(paramPos, i, '\0');
}
default:
{
continue;
}
}
while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
{
stringPos++;
}
while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
{
stringPos++;
}
paramPos++;
}
do
{
if ((delim = format[formatPos++]) > ' ')
{
if (delim == '\'')
{
while ((delim = format[formatPos++]) && delim != '\'') {}
}
else if (delim != 'z')
{
return delim;
}
}
}
while (delim > ' ');
return 0;
}
////////////////////////////////////////////////////////////////////////////////