script
#1

Ok, i got a script, and this script works in a gamemode but in the other its bugged

Can someone tell me why, i installed it correctly

pawn Код:
if(strcmp(cmd,"/makeleader",true)==0)
    {
    new PlayerName[24]; // We create a variable which will contain the players name.
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    if(strcmp(PlayerName,"[LSB]TheGame[TS]",true)) // We use strcmp to check if the player who entered the car is the same as 'Matthias'
    {
    SendClientMessage(playerid, RED, "SERVER MESSAGE: You are not the Server Owner!");
    return 1;
    }
    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "INFO: /makeleader [playerid] [factionname]");
    if(strlen(tmp2) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "INFO: /makeleader [playerid] [factionname]");
    {
    if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, COLOR_RED, "ERROR : This player is not connected!");
    if(!strcmp(tmp2,"GS"))
    {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][GSLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Grove Street Families Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"SBF"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][SBFLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Seville Boulevard Families Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"TDF"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][TDFLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Temple Drive Families Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"IB"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][IBLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Front Yard Ballas Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"JB"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][JBLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Rollin Height Ballas Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"KTB"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][KTBLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Kilo Tray Ballas Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"V"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][VLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the East Beach Vagos Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"Varios"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][VariosLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the El Corona Aztecas Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"TDB"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][TDBLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Temple Drive Ballas Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"FF"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][FFLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Forelli Family Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"rifas"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][RIFASLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Los Santos Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"ELS"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][ELSLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the East Los Santos Ballas Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
    if(!strcmp(tmp2,"LC"))
        {
        new otherplayerid;
        otherplayerid = strval(tmp);
        PlayerData[otherplayerid][LCLeader] = 1;
        new otherid[24];
        GetPlayerName(otherplayerid, otherid, sizeof(otherid));
        format(string, sizeof string, "%s has been given the Los Cabrones Cartel Leader Rights by [LSB]TheGame[TS]", otherid);
        SendClientMessageToAll(RED, string);
        SendClientMessage(otherplayerid,ORANGE, "** To check your commands as leader. type /leaderinfo");
        SendClientMessage(otherplayerid,ORANGE, "* Read about the street credit at /streetcredit or wwww.lsbclan.com");
        return 1;
        }
        else
        {
        SendClientMessage(playerid, RED, "   You didn't type a right faction name");
        }
    return 1;
        }
}
Can someone tell me why it doesn't works at the other gamemode?
Reply
#2

What do you mean by bugged? Maybe you're using a different username and the username check fails ?
Reply
#3

Q: Can someone tell me why it doesn't works at the other gamemode?
A: You are using emulator PlayerData, and on other gamemodes that enum doesnt exists
Reply
#4

The command works but

when the player types /makeleader 0 TDB/GS whatever

no matter what it always returns INFO : /makeleader playerid gangname
Reply
#5

You can't just copy entire commands from gamemodes and expect it to work.
Reply
#6

dude, i made this script from scratch

i didnt took it from any gamemode

i just passed it from my gamemode to another gamemode and it didnt work

can someone tell me why it doesnt works on other gamemode
Reply
#7

You are not the Server Owner!
Reply
#8

wtf ur talking about lol

if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "INFO: /makeleader [playerid] [factionname]"); if(strlen(tmp2) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "INFO: /makeleader [playerid] [factionname]");

theres something wrong in this

in my testing server it works

but in a friends server it always return /makeleader id factionname
Reply
#9

I see you use old way of scripting so i guess you using crappy STRTOK

If so maybe you forgot to add
pawn Код:
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext,idx);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)