STRING PROBLEM
#8

Where to define? Could you write code? Dont get it now what you mean, here just whole script. Startet with 0. Blank script, going to be RP Selfmade!

pawn Код:
#include <a_samp>
#include <dini>


//Qutestions
new RegistrationStep[MAX_PLAYERS];
//AdminScript


//info
enum PInfo
{
    Adminlevel,
    Faction,
    pAge,
    pSex,
}
new PlayerInfo[MAX_PLAYERS][PInfo]; //wieviele es geben soll

//RandomMessages
new randomMSG[][] =
{
    "(------------{FEFEFE}TEAMSPEAK{FF8C00}--------------)\n{FEFEFE}Please join & idle our Teamspeak 3 Server\n{FEFEFE}IP: {FF8C00}85.25.147.170:9987\n{FF8C00}(----------------------------------)",
    "(------------{FEFEFE}TEAMSPEAK{FF8C00}--------------)\n{FEFEFE}Please join & idle our Teamspeak 3 Server\n{FEFEFE}IP: {FF8C00}85.25.147.170:9987\n{FF8C00}(----------------------------------)",
    "(------------{FEFEFE}TEAMSPEAK{FF8C00}--------------)\n{FEFEFE}Please join & idle our Teamspeak 3 Server\n{FEFEFE}IP: {FF8C00}85.25.147.170:9987\n{FF8C00}(----------------------------------)"
};
forward SendMSG();


//Colour Defines
#define GREY 0xAFAFAFAA
#define YELLOW 0xFFFF00AA
#define WHITE 0xFAFAFAFF
#define DARKGREEN 0x007414FF
#define GREEN 0x00FF1EFF
#define BLUE 0x00AFFFFF
#define ORANGE 0xFF8C00FF
#define RED 0xFF000FFF
#define LIGHTBROWN 0xAB8E00FF
#define LIGHTBLUE 0x33CCFFAA
#define LIGHTRED 0xFF6347AA
#define COLOR_USAGE 0xE6E6E6FF



//Registration



//Vehicles


new engine,lights,alarm,doors,bonnet,boot,objective;//This will create the engine/lights,etc varibles
//---------------------------------------------

//Anticheat
forward clearspam(playerid);





//Text

//Tacho
new Float:svx[MAX_PLAYERS]; // Holds Velocity X
new Float:svy[MAX_PLAYERS]; // Holds Velocity Y
new Float:svz[MAX_PLAYERS]; // Holds Velocity Z
new Float:s1[MAX_PLAYERS]; // This Is What Our Forumula Outputs
new s2[MAX_PLAYERS]; // This Is The Output When The Forumula's Ouput Is Round
new s3[MAX_PLAYERS][256]; // This Is The Text That Is Displayed To The User
new Text:sdisplay[MAX_PLAYERS]; // This Holds The Textdraw's ID
new stimer[MAX_PLAYERS]; // This Holds The Timer's ID (Used To Refresh Speed)
forward speedometer(playerid); // This Forwards The Timer To Our Function


//Gangs-Factions
new pTeam[MAX_PLAYERS]; //The variable storing a player's team

// The Team Defines
#define team_lspd 1 // team to design lspd officers
#define team_civ  2 // team to design civilians

// To assign a player to one of those two teams, write this



//Advertisement


//WebUrl TextDraw
new Text:weburl;

//DIALOG REGISTER -- Login
#define DIALOG_REGISTER 0
#define DIALOG_LOGIN 1
#define DIALOG_STATS 2
//LS- DrivingSchool GATES (Open-/-lose)
//StatsDialog
forward MyDialogStatsSystem(playerid);
//PayDay forward
forward payday();
//HandyShopLS
new handyshopls;
new handyshoplsexit;
new buyhandy;
//Lifepoints
forward lifepoints();
forward lptimer();
//KEBAB-DRIVINSCHOOL
//Center-LS
new centerlsenter;
new centerlsexit;
new centerlsenterroom1;
new centerlsexitroom1;
new joblist1;
//LSPD - ENTER/EXIT
new lspdenter;
new lspdexit;
new lspdskinicon;
new Menu:lspdskinmenu;
new lspdweaponpack;
#define DIALOG_LSPDWEAPONPACK 3
//BurgerShotNorth
new bsnenter;
new bsnexit;
//Save Stats







main()
{
    print("\n----------------------------------");
    print(" CFRP-Server");
    print("----------------------------------\n");
}



public OnGameModeInit()
{
    //Weburl
    weburl = TextDrawCreate(4.000000,435.000000,"www.go2samp.tk");
    TextDrawFont(weburl,2);
    TextDrawColor(weburl,0xFFFFFFAA);
    TextDrawLetterSize(weburl,0.599999,1.000000);
    TextDrawSetOutline(weburl,1);
    TextDrawSetShadow(weburl,1);
    TextDrawSetProportional(weburl,1);
    TextDrawBackgroundColor(weburl,0x000000ff);
    //RandomMessages__
    SetTimer("SendMSG",60000, true); // The " 60000 " is 1 min in milliseconds, change this to whatever you would like, it selects and sends a random msg every 1 min in the time i set.
    //WebURL

    //Vehicles
    ManualVehicleEngineAndLights();
    //Handybuy
    buyhandy=CreatePickup(1239,1,-2235.3987,130.1578,1035.4141);
    Create3DTextLabel("/buy phone",0x00B9FFFF,-2235.3987,130.1578,1035.4141,10,0);
    //LS-Drivingschool GATES-
    //BSN EAT MENU
    //Lifepoints
    SetTimer("LP",300000,1);
    SetTimer("lptimer",600000,1);
    //PayDay Timer
    SetTimer("Payday",600000,1);
    //AntiCheat Timer
    //Advertisement Timer
    //LSPD ENTER/EXIT
    Create3DTextLabel("/lspdpack",0x00B9FFFF,256.8204,63.7503,1003.6406,10,0);
    lspdweaponpack=CreatePickup(1239,1,256.8204,63.7503,1003.6406);
    lspdenter=CreatePickup(1318,1,1555.4916,-1675.5988,16.1953);
    lspdexit=CreatePickup(1318,1,246.4607,62.3334,1003.6406);
    lspdskinicon=CreatePickup(1242,1,254.8959,62.8903,1003.6406);
    lspdskinmenu=CreateMenu("Skins", 1, 4.000000, 222.000000, 100.0, 100.0);
    AddMenuItem(lspdskinmenu, 0, "Next Skin");
    AddMenuItem(lspdskinmenu, 0, "Accept");
    //3D TEXT LABEL
    Create3DTextLabel("BSN\n Enter",BLUE,1199.2841,-918.7192,43.1187,15,0); // 10 fьr Weite, von wo man sehen kann, 0 fьr Virtuelle Welt.
    //Center-LS
    centerlsenter=CreatePickup(1318,1,1209.1230,-1752.0439,13.5935);
    centerlsexit=CreatePickup(1318,1,1700.5529,-1667.6858,20.2188);
    centerlsenterroom1=CreatePickup(1318,1,1735.0865,-1659.9849,23.7189);
    centerlsexitroom1=CreatePickup(1318,1,2315.7200,0.0491,26.7422);
    joblist1=CreatePickup(1239,1,2308.8784,-2.1824,26.7422);
    Create3DTextLabel("/jobs",0x00B9FFFF,2308.8784,-2.1824,26.7422,10,0);
    //BURGERSHOT-NORTH
    bsnenter=CreatePickup(1318,1,1199.3766,-918.1311,43.1225);
    bsnexit=CreatePickup(1318,1,362.9404,-75.2187,1001.5078);
    //Handyshop_LOS SANTOS
    handyshopls=CreatePickup(1318,1,1154.7013,-1439.9070,15.7969);
    handyshoplsexit=CreatePickup(1318,1,-2240.7676,137.3462,1035.4141);
    //HOTELZIVISPAWN-LOS SANTOS
    //CJ Movement
    UsePlayerPedAnims();
    //Disable all Eingдnge
    DisableInteriorEnterExits();
    //MTA Mapping buildings
//--------------------------------------------------------------[LSPD -- GATE & CARS] ---------------------------------------

//-----------------------------------------------------CIVILIAN-SPAWN_-------------------------------------------------------------------------------
    AddStaticVehicleEx(481,1118.20275879,-1775.02539062,13.20102215,272.00000000,33,11,15); //BMX
    AddStaticVehicleEx(481,1118.10913086,-1773.64794922,13.20090771,271.99951172,33,11,15); //BMX
    AddStaticVehicleEx(481,1118.02038574,-1772.19885254,13.20079899,271.99951172,33,11,15); //BMX
    AddStaticVehicleEx(481,1118.11523438,-1770.69104004,13.20091534,271.99951172,33,11,15); //BMX
    AddStaticVehicleEx(481,1118.08312988,-1776.41137695,13.20087528,271.99951172,33,11,15); //BMX
    CreateObject(983,1606.22106934,-1615.58361816,13.21591854,0.00000000,0.00000000,268.00000000); //object(fenceshit3) (1)
    CreateObject(983,1098.49560547,-1777.11376953,13.20005989,0.00000000,0.00000000,270.00000000); //object(fenceshit3) (2)
    CreateObject(983,1092.12719727,-1777.12915039,13.20044231,0.00000000,0.00000000,270.00000000); //object(fenceshit3) (3)
    CreateObject(983,1085.75488281,-1777.13903809,13.20068932,0.00000000,0.00000000,270.00000000); //object(fenceshit3) (4)
    CreateObject(983,1079.37438965,-1777.14270020,13.20077991,0.00000000,0.00000000,270.00000000); //object(fenceshit3) (5)
    CreateObject(983,1073.00061035,-1777.14050293,13.20072556,0.00000000,0.00000000,270.00000000); //object(fenceshit3) (6)
    CreateObject(983,1066.61975098,-1777.14392090,13.20081043,0.00000000,0.00000000,270.00000000); //object(fenceshit3) (7)
    CreateObject(983,1062.51599121,-1777.15527344,13.20109367,0.00000000,0.00000000,270.00000000); //object(fenceshit3) (8)
    CreateObject(983,1059.30102539,-1773.97509766,13.20538425,0.00000000,0.00000000,180.00000000); //object(fenceshit3) (9)
    CreateObject(983,1059.29687500,-1767.60205078,13.22572327,0.00000000,0.00000000,179.99450684); //object(fenceshit3) (10)
    CreateObject(983,1059.30480957,-1761.21765137,13.24579906,0.00000000,0.00000000,179.99450684); //object(fenceshit3) (11)
    CreateObject(983,1059.30273438,-1754.84497070,13.26608658,0.00000000,0.00000000,179.99450684); //object(fenceshit3) (12)
    CreateObject(983,1059.28515625,-1748.45642090,13.28680992,0.00000000,0.00000000,179.99450684); //object(fenceshit3) (13)
    CreateObject(983,1059.27795410,-1742.09240723,13.30719757,0.00000000,0.00000000,179.99450684); //object(fenceshit3) (14)
    CreateObject(983,1059.27624512,-1738.92639160,13.31729412,0.00000000,0.00000000,179.99450684); //object(fenceshit3) (15)
    CreateObject(983,1062.47009277,-1735.69897461,13.34762096,0.00000000,0.00000000,89.99450684); //object(fenceshit3) (16)
    CreateObject(983,1068.86401367,-1735.70556641,13.36463547,0.00000000,0.00000000,89.99450684); //object(fenceshit3) (17)
    CreateObject(983,1075.24938965,-1735.69934082,13.38194752,0.00000000,0.00000000,89.99450684); //object(fenceshit3) (18)
    CreateObject(983,1081.63818359,-1735.70715332,13.39891911,0.00000000,0.00000000,89.99450684); //object(fenceshit3) (19)
    CreateObject(983,1088.02575684,-1735.72192383,13.41571331,0.00000000,0.00000000,89.99450684); //object(fenceshit3) (20)
    CreateObject(983,1094.41381836,-1735.74169922,13.43238449,0.00000000,0.00000000,89.99450684); //object(fenceshit3) (21)
    CreateObject(983,1101.77185059,-1773.91247559,13.19839859,0.00000000,0.00000000,0.00000000); //object(fenceshit3) (23)
    CreateObject(983,1101.77868652,-1767.50549316,13.19848442,0.00000000,0.00000000,0.00000000); //object(fenceshit3) (24)
    CreateObject(983,1101.77099609,-1761.11706543,13.19838810,0.00000000,0.00000000,0.00000000); //object(fenceshit3) (25)
    CreateObject(983,1101.78527832,-1754.73291016,13.19856644,0.00000000,0.00000000,0.00000000); //object(fenceshit3) (26)
    CreateObject(983,1100.84191895,-1735.72460938,13.45016575,0.00000000,0.00000000,89.99450684); //object(fenceshit3) (27)
    // Don't use these lines if it's a filterscript
    SetGameModeText("CF-RP v0.1");
//-----------------------------NORMAL SKINS---------------------------------------------------
    AddPlayerClass(101,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(146,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(18,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(128,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(202,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(258,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(176,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(177,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(16,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(135,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(181,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(137,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(239,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(1,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(0,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(242,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(29,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(50,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(79,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(83,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(143,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(144,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(170,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(180,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(185,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(188,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(19,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(20,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(21,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(22,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(221,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(240,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(25,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(28,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(35,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(46,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(48,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(67,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(7,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
    AddPlayerClass(72,1107.2620,-1796.1250,16.5938,90.7246,0,0,0,0,0,0);
   
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid,-689.1093,940.1411,13.6328);
    SetPlayerFacingAngle(playerid,267.5411);
    SetPlayerCameraPos(playerid,-686.2167,940.4254,13.6328);
    SetPlayerCameraLookAt(playerid,-689.1093,940.1411,13.6328);
    return 1;
}

public OnPlayerConnect(playerid)
{
    TextDrawShowForPlayer(playerid,weburl);
    pTeam[playerid] = team_civ; //Sets a player's team to civ
    new Userfolder[64]; //Login,
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(Userfolder,sizeof(Userfolder),"/Users/%s.txt",name);
    if(dini_Exists(Userfolder)) //Wenn die Datei Existiert, dann soll..
    {
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Your account has been found. Please enter your password:","Login","Cancel");
       
    }
    else
    {
        ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password:","Register","Cancel");
        SetPlayerCameraLookAt(playerid,1850.8317,1494.7621,10.8203);
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    UserSave(playerid); //Spieler Speichern wenn man off geht
    ResetVariable(playerid); //Variablen zurьcksetzen damit die nicht woanders ьbergeben werden
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new newtext[41], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(newtext, sizeof(newtext), "~w~Welcome ~b~%s", name);
    GameTextForPlayer(playerid, newtext, 1000, 1);
    if(GetPlayerTeam(playerid) == 1) SetPlayerPos( playerid, 255.1449,66.4737,1003.6406); //If player is lspd, he spawns at lspd
    if(GetPlayerTeam(playerid) == 2) SetPlayerPos( playerid, 1654.8550,-1659.3982,22.5156); //If player is civilian, he spawns at civispawn
   
   
    if(RegistrationStep[playerid] == 0)
    {
        SendClientMessage(playerid,LIGHTBLUE,"What's your Age?");
        SendClientMessage(playerid,WHITE,"Hint: Enter your 2 digit age");
        TogglePlayerControllable(playerid,0); //Freezing the player
        RegistrationStep[playerid] = 1; //Sets our registrationstep to 1
        return 1;
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    if(RegistrationStep[playerid] == 1)
    {
        if(!strlen(text)) //Checks to make sure there is atleast 1 character input
        {
            SendClientMessage(playerid,LIGHTBLUE,"What's your Age?");
            SendClientMessage(playerid,WHITE,"Hint: Enter your 2 digit age");
            return 0; //Ends the commands and doesnt display in text
        }
        if(strlen(text)< 2||strlen(text) > 2)//Checks that the input is only 2 characters long
        {
            SendClientMessage(playerid,0xD70000FF,"Only a 2 digit number will work!");
            return 0;
        }
        new string[128]; //Creates a new string 128 characters long
        format(string,sizeof(string),"Ok so you are %d years old",strval(text)); //Formats the string
        SendClientMessage(playerid,LIGHTBLUE,string); //Sends new message with the string
        PlayerInfo[playerid][pAge] = strval(text);
        SendClientMessage(playerid,LIGHTBLUE,"What is your Sex?");
        SendClientMessage(playerid,WHITE,"Hint: Enter male or female");
        RegistrationStep[playerid] = 2;
        return 0;

    }
    if(RegistrationStep[playerid] == 2)
    {
        new tmp[4];
        if(!strlen(text)) //Check to make sure there is at least 1 character input
        {
            SendClientMessage(playerid,LIGHTBLUE,"What is your Sex?");
            SendClientMessage(playerid,WHITE,"Hint: Enter male or female");
            return 0;
        }
        if(!strcmp("male", tmp, true, 4))
        {//Checks to see if the input matches "female" and if it does continues
            PlayerInfo[playerid][pSex] = strval(text);
            PlayerInfo[playerid][pSex] = 2;
            SendClientMessage(playerid,LIGHTBLUE,"Ok, so you are a male.");
            SendClientMessage(playerid,WHITE,"Thank you for filling in the information");
            RegistrationStep[playerid] = 3;
            TogglePlayerControllable(playerid,1);//Unfreezes the player and play resumes
            return 0;
        }
        else if(!strcmp("female", tmp, true, 6))
        {//Checks to see if the input matches "female" and if it does continues
            PlayerInfo[playerid][pSex] = strval(text);
            PlayerInfo[playerid][pSex] = 2;
            SendClientMessage(playerid,LIGHTBLUE,"Ok, so you are a Female.");
            SendClientMessage(playerid,WHITE,"Thank you for filling in the information");
            RegistrationStep[playerid] = 3;
            TogglePlayerControllable(playerid,1);//Unfreezes the player and play resumes
            return 0;
        }
        else
        { SendClientMessage(playerid,WHITE,"Please answer your Gender!"); return 0; }
    }

    SetPVarInt(playerid,"textspam",GetPVarInt(playerid,"textspam")+1);
    if(GetPVarInt(playerid,"textspam") == 5)
    {
        new string[128];
        new tname[MAX_PLAYER_NAME];
        GetPlayerName(playerid,tname,sizeof(tname));
        format(string,sizeof(string),"Chuck Norris: %s(%d) has been kicked for excess flood (text spam)",tname,playerid);
        SendClientMessageToAll(0xAA3333AA,string);
        Kick(playerid);
    }
    else if(GetPVarInt(playerid,"textspam") == 4)
    {
        SendClientMessage(playerid,0xAA3333AA,"stop spamming or you will be kicked! (wait 5 seconds)");
        return 0;
    }
    SetTimerEx("clearspam",5000,false,"d",playerid);
    return 1;
}
//-----------------------------------------------[COMMANDS]----------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/lspdpack", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,1,256.8204,63.7503,1003.6406))
        {
            ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "Choose your Weaponpack!", "Weaponpack.1","Take","Cancel");
        }
        else
        {
            SendClientMessage(playerid, 0xAF2800FF,"You have to stand in the pickup");
        }
        return 1;
    }
    if(strcmp(cmdtext, "/makeleader", true) ==0)
    {
        SendClientMessage(playerid, COLOR_USAGE, "Test cmd, you are lspd now");
        SetPlayerTeam(playerid, 1);
        return 1;
    }
    if(strcmp(cmdtext, "/leavefaction", true) ==0)
    {//If player is civilian, he spawns at civispawn
        SetPlayerTeam(playerid, 2);
        SendClientMessage(playerid, 0xA50000FF, "You left the faction");
        return 1;
    }
    if(strcmp(cmdtext, "/mylspdpassword", true) ==0)
    {
        SendClientMessage(playerid, GREEN, "You logged in as a LSPD officer.");
        pTeam[playerid] = team_lspd;
        //now you can easily know if he is in lspd or not
        return 1;
    }
    if(strcmp(cmdtext, "/myteam", true) ==0)
    {
        if(pTeam[playerid] == team_lspd) //check if he is lspd officer
        {
            SendClientMessage(playerid,DARKGREEN, "You are a LSPD officer");
            return 1;
        }
        if(pTeam[playerid] == team_civ)
        {
            SendClientMessage(playerid, DARKGREEN, "Yiz are a civilian");
            return 1;
        }
        return 1;
    }
   
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmdtext, "/afk", true) == 0)
    {
        new pName[MAX_PLAYER_NAME]; // Saying pName is the Players Name!
        new string[128]; // Creating the string.
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME); // tells the pName to get the players name!
        format(string, sizeof(string), "--> %s is now AFK",pName); // This is what will send to everyone!
        SendClientMessageToAll(LIGHTBROWN, string); // This is what makes the "string" send in the "COLOR_BLUE"!
        GameTextForPlayer(playerid,"~w~You ~b~are ~r~AFK ~w~now!",3000,5);
        TogglePlayerControllable(playerid, 0); // Makes it so the player cannot move.
        SetPlayerHealth(playerid, 999999.999); // Sets the players health so he is invincible! So noone can kill him.
        return 1;
    }
    //BACK
    if(strcmp(cmdtext, "/back", true) == 0)
    {
        new pName[MAX_PLAYER_NAME]; // Saying pName is the Players Name!
        new string[128]; // Creating the string.
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME); // tells the pName to get the players name!
        format(string, sizeof(string), "--> %s is now BACK",pName); // This is what will send to everyone!
        SendClientMessageToAll(LIGHTBROWN, string); // This is what makes the "string" send in the "COLOR_BLUE"!
        GameTextForPlayer(playerid,"~w~You ~b~are ~r~BACK ~w~now!",3000,5);
        TogglePlayerControllable(playerid, 1); // Makes it so the player can move.
        SetPlayerHealth(playerid, 100); // Sets the players health back to normal. He is now killable.
        return 1;
    }
    //Turn lights on
    if(strcmp(cmdtext, "/lights on", true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }
    //Turn off lights
    if(strcmp(cmdtext, "/lights off", true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }
    //StartEngine
    if(strcmp(cmdtext, "/start engine", true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }
    //Turn off Engine
    if(strcmp(cmdtext, "/stop engine", true) == 0)
    {
        new vid = GetPlayerVehicleID(playerid);
        if(vid != INVALID_VEHICLE_ID)
        {
            GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
        return 1;
    }
    if(strcmp(cmdtext, "/buy phone", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,1,-2235.3987,130.1578,1035.4141))
        {

        }
        else
        {
            SendClientMessage(playerid, 0xAF2800FF,"You have to stand in the pickup");

        }
        return 1;
    }
    if(strcmp(cmdtext, "/stats", true) == 0) // unser Command, kann natьrlich auch anders angeordnet sein jenachdem wie er bei euch im Script definiert ist!
    {
        MyDialogStatsSystem(playerid); // Цffnet unsere Stats :5
        return 1;
    }
    if(strcmp(cmdtext, "/jobs", true) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,1,2308.8784,-2.1824,26.7422))
        {
            SendClientMessage(playerid,DARKGREEN,"Will come soon..");
        }
        else
        {
            SendClientMessage(playerid, 0xAF2800FF,"You have to stand in the pickup");
        }
        return 1;
    }
    if(strcmp(cmdtext, "/score5", true) == 0)
    {
        SetPlayerScore(playerid,5); //Um level zu setzen
        return 1;
    }
    if(strcmp(cmdtext, "/test", true) == 0)
    {
        SendClientMessage(playerid,ORANGE,"This command will give you {FF0000}$500 & -60HP");
        GivePlayerMoney(playerid, 500);
        SetPlayerHealth(playerid, 10.0);
        return 1;
    }
    if(strcmp(cmdtext, "/help", true) == 0)
    {
        SendClientMessage(playerid,ORANGE,"|________HELP________|");
        SendClientMessage(playerid,ORANGE,"** MAIN ** {FF0000}/about /score5 /afk /back");
        SendClientMessage(playerid,ORANGE,"** FUN ** {FF0000}/test /makeleader /leavefaction ");
        SendClientMessage(playerid,ORANGE,"** CAR ** {FF0000}/start engine /stop engine /lights on /lights off");
        if(GetPlayerTeam(playerid) == 1)
        {
            SendClientMessage(playerid,ORANGE,"** COP ** {FF0000}/lspdopen /lspdclose");
        }
        return 1;
    }
    if(strcmp(cmdtext, "/about", true) == 0)
    {
        SendClientMessage(playerid,ORANGE,"|________ABOUT________|");
        SendClientMessage(playerid,WHITE,"Crossfire Roleplay Server 0.3c");
        SendClientMessage(playerid,WHITE,"Script: CF-RP v0.1 by ScoOf");
        SendClientMessage(playerid,WHITE,"Server location: Germany");
        SendClientMessage(playerid,WHITE,"mIRC: #crossfire");
        SendClientMessage(playerid,ORANGE,"|_____________________|");
        return 1;
    }

    new stringx[128];
    format(stringx,sizeof(stringx),"There is no '%s' Command.",cmdtext);
    return SendClientMessage(playerid, 0x9AFF9DFF,stringx);
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    KillTimer(stimer[playerid]); // This Stops Our Timer For When You Get Out Of Your Vehicle Your Speed Doesn't Keep Going
    TextDrawSetString(sdisplay[playerid], " "); // This Sets Our Textdraw To Blank And Freezes Because We Stop The Timer ^
    if(newstate == 2) stimer[playerid] = SetTimerEx("speedometer", 255, true, "i", playerid); // This Starts The Timer When The Player Changes His/Her State To Being The Driver
    else if(newstate == 3) stimer[playerid] = SetTimerEx("speedometer", 250, true, "i", playerid); // This Start The Timer When The Player Changes His/Her Start To Being The Passenger
    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)
{
    if(pickupid==lspdweaponpack)
    {
   
    }
    if(pickupid==lspdskinicon)
    {
        ShowMenuForPlayer(lspdskinmenu, playerid);
    }
    if(pickupid==lspdenter)
    {
        SetPlayerPos(playerid,246.5495,65.7718,1003.6406);
        SetPlayerInterior(playerid,6);
        GameTextForPlayer(playerid,"~w~You've entered ~g~lspd",2000,1);
    }
    if(pickupid==lspdexit)
    {
        SetPlayerPos(playerid,1552.3674,-1675.7428,16.1953);
        SetPlayerFacingAngle(playerid,84.1017);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid,0);
    }
    if(pickupid==buyhandy)
    {
   
    }
    if(pickupid==handyshoplsexit)
    {
        SetPlayerPos(playerid,1151.5850,-1439.7634,15.7969);
        SetPlayerFacingAngle(playerid,80.3083);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid,0);
    }
    if(pickupid==handyshopls)
    {
        SetPlayerPos(playerid,-2235.9927,134.6555,1035.4141);
        SetPlayerInterior(playerid,6);
        GameTextForPlayer(playerid,"~w~You've entered Dario's RC ~g~Shop",2000,1);
    }
    if(pickupid==joblist1)
    {
   
    }
    if(pickupid==bsnexit)
    {
        SetPlayerPos(playerid,1199.6576,-921.5980,43.0234);
        SetPlayerFacingAngle(playerid,172.8399);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid,0);
    }
    if(pickupid==bsnenter)
    {
        SetPlayerPos(playerid,365.2788,-73.7581,1001.5078);
        SetPlayerInterior(playerid,10);
        GameTextForPlayer(playerid,"~w~You've entered ~g~BSN",2000,1);
    }
    if(pickupid==centerlsexitroom1)
    {
        SetPlayerPos(playerid,1733.5239,-1663.2610,23.7105);
        SetPlayerFacingAngle(playerid,133.7527);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid,18);
    }
    if(pickupid==centerlsenterroom1)
    {
        SetPlayerPos(playerid,2313.9487,-7.8492,26.7422);
        SetPlayerInterior(playerid,0);
        GameTextForPlayer(playerid,"~w~You've entered job ~g~room",2000,1);
    }
    if(pickupid==centerlsexit)
    {
        SetPlayerPos(playerid,1206.3501,-1748.3485,13.5929);
        SetPlayerFacingAngle(playerid,28.5475);
        SetCameraBehindPlayer(playerid);
        SetPlayerInterior(playerid,0);
    }
    if(pickupid==centerlsenter)
    {
        SetPlayerPos(playerid,1710.433715,-1669.379272,20.225049);
        SetPlayerInterior(playerid,18);
        GameTextForPlayer(playerid,"~w~You've entered Center ~g~LS",2000,1);
    }
    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)
{
    new Menu:CurrentMenulspd = GetPlayerMenu(playerid);
    if(CurrentMenulspd == lspdskinmenu)
    {
        switch(row)
        {
            case 0: //Case 0 fьr erste Item im Menu
            {
                if(GetPlayerTeam(playerid) == 1)
                {
                    SetPlayerSkin(playerid, 265);
                }
                else
                {
                    SendClientMessage(playerid,0xA50000FF, "You're not a Cop");
                }
            }
            case 1:
            {
           
            }
        }
    }
    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[])
{
    if(dialogid==DIALOG_LSPDWEAPONPACK)
    {
        switch(listitem)
        {
            case 0:
            {
                if(GetPlayerTeam(playerid) == 1)
                {
                    GivePlayerWeapon(playerid, 3, 500);
                    GivePlayerWeapon(playerid, 24, 30);
                    SetPlayerArmour(playerid, 100.0);
                    SetPlayerHealth(playerid, 100.0);
                }
                else
                {
                    SendClientMessage(playerid,0xA50000FF, "You're not a Cop");
                }
             }
        }
    }
    if(dialogid==DIALOG_STATS)
    {
        if(response==0)
        {
            return 1;
        }
        if(response==1)
        {
            return 1;
        }
    }
    if(dialogid==DIALOG_LOGIN)
    {
        if(response==0) //Wenn man zweite Button drьckt
        {
            SendClientMessage(playerid,RED,"You canceled the process.");
            Kick(playerid);
            return 1;
        }
        if(response==1) //Wenn man erste button Drьckt
        {
            if(!strlen(inputtext)) //falls nichts eingegeben wird
            {
                SendClientMessage(playerid,RED,"Password is too short.");
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Your account has been found. Please enter your password:","Login","Cancel");
                return 1;
            }
            else
            {
                Login(playerid,inputtext); //Neuer stock fьr Login
                return 1;
            }
        }
    }
    if(dialogid==DIALOG_REGISTER)
    {
        if(response==0) //Wenn man zweite Button drьckt
        {
            SendClientMessage(playerid,RED,"You canceled the process.");
            Kick(playerid);
            return 1;
        }
        if(response==1) //Wenn man erste button Drьckt
        {
            if(!strlen(inputtext)) //falls nichts eingegeben wird
            {
                SendClientMessage(playerid,RED,"Password is too short.");
                ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password:","Register","Cancel");
                return 1;
            }
            else
            {
                Register(playerid,inputtext);
                return 1;
            }
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}
public payday()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        SendClientMessage(i,DARKGREEN,"Payday! You received $10.000!");
        GivePlayerMoney(i,10000);
    }
    return 1;
}
public lifepoints()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        SetPlayerHealth(i, -2.0);
    }
}
public lptimer()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
          new Float:health;
          GetPlayerHealth(i,health);
          SetPlayerHealth(i,health-2);
    }
}

stock Register(playerid, key[]) //Mit stock eine neue Definition erstellen. key fьr passwort
{
    new Userfolder[64];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(Userfolder,sizeof(Userfolder),"/Users/%s.txt",name);
    dini_Create(Userfolder); //Erstellt Ordner
    dini_Set(Userfolder,"Password",key);//Erstellt Variable fьr Passwort z.B
    SendClientMessage(playerid,DARKGREEN,"Successfully registered"); //Fьr level, IntSet kommt nur bei Zahlen!
    SetPlayerScore(playerid,0);
    GivePlayerMoney(playerid, 5500);
    return 1;
}

stock Login(playerid,key[])
{
    new Userfolder[64];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(Userfolder,sizeof(Userfolder),"/Users/%s.txt",name);
    if(!strcmp(key,dini_Get(Userfolder,"Password"),false)) //false fьr groЯ und klein schreibung
    {
        LoadAccount(playerid);//Level vom Spieler wird ausgelesen, playerscore wird festgelegt, dini_int was auslesen, dini_intset etwas einsetzen
        SendClientMessage(playerid,DARKGREEN,"Successfully logged in");
        return 1;
    }
    else
    {
        SendClientMessage(playerid,RED,"Wrong password.");
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Your account has been found. Please enter your password:","Login","Cancel");
        return 1;
    }
}

stock LoadAccount(playerid)
{
    new Userfolder[64];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(Userfolder,sizeof(Userfolder),"/Users/%s.txt",name);
    SetPlayerScore(playerid,dini_Int(Userfolder,"Level"));// Score wird wieder gegeben, mit dini_int wird gelsen
    GivePlayerMoney(playerid,dini_Int(Userfolder,"Cash")); //Geld wird gegeben was man hatte, das gespeicherte
    PlayerInfo[playerid][Adminlevel]=dini_Int(Userfolder,"Adminlevel");
    PlayerInfo[playerid][Faction]=dini_Int(Userfolder,"Faction");
    PlayerInfo[playerid][pSex]=dini_Int(Userfolder,"pSex");
    PlayerInfo[playerid][pAge]=dini_Int(Userfolder,"pAge");
    return;
}

stock UserSave(playerid)
{
    new Userfolder[64];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(Userfolder,sizeof(Userfolder),"/Users/%s.txt",name);//Es wird in der SpielerDatei gespeichert
    dini_IntSet(Userfolder,"Level",GetPlayerScore(playerid)); //Level Speichern, mit Int eine Zahl speichern. Userfolder wo, welche Reihe fьr Level und was soll er speichern, getplayerscore
    dini_IntSet(Userfolder,"Cash",GetPlayerMoney(playerid)); //Geld Speichern
    dini_IntSet(Userfolder,"Adminlevel",PlayerInfo[playerid][Adminlevel]);
    dini_IntSet(Userfolder,"Faction",PlayerInfo[playerid][Faction]);
    dini_IntSet(Userfolder,"pSex",PlayerInfo[playerid][pSex]);
    dini_IntSet(Userfolder,"pAge",PlayerInfo[playerid][pAge]);
    dini_IntSet(Userfolder,"Faction",PlayerInfo[playerid][Faction]);
    return 1;
}

stock ResetVariable(playerid)
{
    PlayerInfo[playerid][Adminlevel]=0;
    return 1;
}

public MyDialogStatsSystem(playerid)
{
    new String[128], Name[MAX_PLAYER_NAME], Cash = GetPlayerMoney(playerid), Score = GetPlayerScore(playerid), Gender = PlayerInfo[playerid][pSex], Age = PlayerInfo[playerid][pAge]; // String, Name, Geld, und Score angelegt.
    GetPlayerName(playerid,Name,sizeof Name);
    format(String, sizeof(String), "[Stats of %s]\n[Nickname]: %s  [Level]: %d  [Money]: %d  [Gender]: %s  [Age]: %d", Name, Name, Score, Cash, Gender, Age); // Unsere (New's) die wir oben neu angelegt haben - immer mit einem , trennen :5
    ShowPlayerDialog(playerid, DIALOG_STATS, 0, "My stats", String, "Close", " "); // Цffne das Dialog fenster beim Spieler
    return 1;
}

public speedometer(playerid)
{
    GetVehicleVelocity(GetPlayerVehicleID(playerid), svx[playerid], svy[playerid], svz[playerid]); // This Saves Our Velocitys To Our Varibles
    s1[playerid] = floatsqroot(((svx[playerid]*svx[playerid])+(svy[playerid]*svy[playerid]))+(svz[playerid]*svz[playerid]))*100; // This Is Our Forumula ( I Don't Know How It Works )
    s2[playerid] = floatround(s1[playerid],floatround_round); // This Rounds Our Output To The Nearest Whole Number
    format(s3[playerid],256,"%i ~g~MPH", s2[playerid]); // This Format Our Text Into What We See
    TextDrawSetString(sdisplay[playerid], s3[playerid]); // This Changes The Value Of Our Textdraw To What We Formatted
    return 1;
}

public clearspam(playerid)
{
    SetPVarInt(playerid,"textspam",0);
}




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':
            {
                setarg(paramPos, 0, _:floatstr(string[stringPos]));
            }
            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;
}

stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

public SendMSG()
{
    new randMSG = random(sizeof(randomMSG)); //calculates the size of RandomMSG (which is 3)
    SendClientMessageToAll(0xFAFAFAFF, randomMSG[randMSG]);
}
Reply


Messages In This Thread
STRING PROBLEM - by NuggaN_ - 13.12.2010, 21:54
Re: STRING PROBLEM - by notime - 13.12.2010, 21:56
Re: STRING PROBLEM - by Lynn - 13.12.2010, 22:00
Re: STRING PROBLEM - by notime - 13.12.2010, 22:06
Re: STRING PROBLEM - by NuggaN_ - 13.12.2010, 22:07
Re: STRING PROBLEM - by Lynn - 13.12.2010, 22:12
Re: STRING PROBLEM - by blackwave - 13.12.2010, 22:12
Re: STRING PROBLEM - by NuggaN_ - 13.12.2010, 22:16
Re: STRING PROBLEM - by Lynn - 13.12.2010, 22:21
Re: STRING PROBLEM - by NuggaN_ - 13.12.2010, 22:26

Forum Jump:


Users browsing this thread: 1 Guest(s)