Need Help With GetPlayerName
#1

I made this but it gives errors that already defined name , already defined string

[code]
if(hackm[targetid] == true)
{
hackm[targetid] = false;
new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
GetPlayerName(targetid, name, sizeof(name));
format(string, sizeof(string), "[HACK] {FFFFFF}You Took Permission From %s .", name);
SendClientMessage(playerid, 0x2EFF83FF, string);
new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[HACK] {FFFFFF}You Permissions Taken By %s .", name);
SendClientMessage(targetid, 0x2EFF83FF, string);
}
else if(hackm[targetid] == false)
{
hackm[targetid] = true;
new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
GetPlayerName(targetid, name, sizeof(name));
format(string, sizeof(string), "[HACK] {FFFFFF}You Have Given Permission To %s .", name);
SendClientMessage(playerid, 0x2EFF83FF, string);
new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "[HACK] {FFFFFF}You Have Been Given Permission By %s .", name);
SendClientMessage(targetid, 0x2EFF83FF, string);
}
Reply
#2

What are the errors, copy paste them here!
Reply
#3

Here, you defined strings and name twice

pawn Код:
if(hackm[targetid] == true)
{
    hackm[targetid] = false;
    new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
    GetPlayerName(targetid, name, sizeof(name));
    format(string, sizeof(string), "[HACK] {FFFFFF}You Took Permission From %s .", name);
    SendClientMessage(playerid, 0x2EFF83FF, string);

    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "[HACK] {FFFFFF}You Permissions Taken By %s .", name);
    SendClientMessage(targetid, 0x2EFF83FF, string);
}
else if(hackm[targetid] == false)
{
    hackm[targetid] = true;
    new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
    GetPlayerName(targetid, name, sizeof(name));
    format(string, sizeof(string), "[HACK] {FFFFFF}You Have Given Permission To %s .", name);
    SendClientMessage(playerid, 0x2EFF83FF, string);

    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "[HACK] {FFFFFF}You Have Been Given Permission By %s .", name);
    SendClientMessage(targetid, 0x2EFF83FF, string);
}
Reply
#4

You declare those 2 again few lines below.
pawn Код:
new name[21], string2[73];
if(hackm[targetid] == true)
{
    hackm[targetid] = false;
    GetPlayerName(targetid, name, sizeof(name));
    format(string2, sizeof(string2), "[HACK] {FFFFFF}You Took Permission From %s .", name);
    SendClientMessage(playerid, 0x2EFF83FF, string2);
    GetPlayerName(playerid, name, sizeof(name));
    format(string2, sizeof(string2), "[HACK] {FFFFFF}You Permissions Taken By %s .", name);
    SendClientMessage(targetid, 0x2EFF83FF, string2);
}
else if(hackm[targetid] == false)
{
    hackm[targetid] = true;
    GetPlayerName(targetid, name, sizeof(name));
    format(string2, sizeof(string2), "[HACK] {FFFFFF}You Have Given Permission To %s .", name);
    SendClientMessage(playerid, 0x2EFF83FF, string2);
    GetPlayerName(playerid, name, sizeof(name));
    format(string2, sizeof(string2), "[HACK] {FFFFFF}You Have Been Given Permission By %s .", name);
    SendClientMessage(targetid, 0x2EFF83FF, string2);
}
Reply
#5

i solved name but now it says string is already defined
Reply
#6

solved everything thx konstantinos
Reply
#7

Use another word than string, for example stringperm
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)