CMD:setaname
#5

How do you work with a script that has that many lines it must be really messy. I can only imagine how many times this must appear

pawn Код:
if(!PlayerInfo[playerid][pAdmin])
    {
        return SendClientMessage(playerid, -1, "You are not an admin.");
    }

How about

#define CheckAdmin(%0) !if(!PlayerInfo[%0][pAdmin]) return SendClientMessage(%0, -1, "You are not an admin.");
Now all you need to do is replace those 4 lines with CheckAdmin(playerid);

Scripts this large need to be done separated into includes with hooking I can only imagine how stupidly large some callbacks must be with a dozen systems it's no wonder your having problems.

In response to your question check this out

pawn Код:
#include <a_samp>

enum test {
    testname[MAX_PLAYER_NAME],
}
new name[MAX_PLAYERS][test];


main() {
    new tmp;
    tmp = "TestName";
    name[0][testname] = tmp;
    print(name[0][testname]);
   
}
This will fail with.....

input(11) : error 6: must be assigned to an array
Error: The compiler failed. (no error code)

This will compile

pawn Код:
#include <a_samp>

enum test {
    testname[MAX_PLAYER_NAME],
}
new name[MAX_PLAYERS][test];


main() {
    new tmp[MAX_PLAYER_NAME];
    tmp = "TestName";
    name[0][testname] = tmp;
    print(name[0][testname]);
}
This will compile

pawn Код:
#include <a_samp>

enum test {
    testname[MAX_PLAYER_NAME],
}
new name[MAX_PLAYERS][test];


main() {
    new tmp[MAX_PLAYER_NAME];
    tmp = "TestName";
    format(name[0][testname], MAX_PLAYER_NAME, "%s", tmp);
    print(name[0][testname]);
}
You can test these here

http://slice-vps.nl:7070/
Reply


Messages In This Thread
CMD:setaname - by James Bob - 17.10.2013, 19:42
Re: CMD:setaname - by James Bob - 17.10.2013, 20:39
Re: CMD:setaname - by LeMoi - 17.10.2013, 20:49
Re: CMD:setaname - by HyperZ - 17.10.2013, 20:50
Re: CMD:setaname - by Pottus - 17.10.2013, 20:59
Re: CMD:setaname - by James Bob - 17.10.2013, 21:12
Respuesta: CMD:setaname - by Alex_Obando - 17.10.2013, 21:57
Re: Respuesta: CMD:setaname - by James Bob - 18.10.2013, 11:04

Forum Jump:


Users browsing this thread: 3 Guest(s)