Whats wrong?
#1

Hey!!
Problem is that when I make somebody leader of org it says: You made (e.g.) mirko leader of ORG: leader 0 2 <- This is what i want to fix. It has to come: ORG: Bolnica.

Here is the code:

PHP код:
CMD:makeleader(playerid,params[])
{
    new 
ID,ime[MAX_PLAYER_NAME],ime2[MAX_PLAYER_NAME],ORGID,poruka[128],poruka2[128];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Nemate dozvolu za tu komandu");
    if(!
IsPlayerConnected(playerid)) return SendClientMessage(playerid,1,""COLOR_CRVENA"Greska:{FFFFFF} Niste ulogirani na serveru");
    if(
sscanf(params,"ud",ID,ORGID)) return SendClientMessage(playerid,-1,"{FFFFFF}Koristenje:"COLOR_LAGANA" /makeleader [ID/Ime] [OrgID]");
    if(
ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Igrac nije ulogiran na server");
    if(
ORGID || ORGID 0) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Maximum organizacija je '3'");
    else
    {
        
GetPlayerName(playerid,ime,sizeof(ime));
        
GetPlayerName(ID,ime2,sizeof(ime2));
        
format(poruka,sizeof(poruka),""COLOR_ZELENA2"[ORG-Info]:"COLOR_CRVENA" VLASNIK{FFFFFF} %s vam je postavio leadera organizacije. ORG: %s",ime,GetOrgName(ORGID));
        
SendClientMessage(ID,-1,poruka);
        
format(poruka,sizeof(poruka),""COLOR_WG"WG:{FFFFFF} Postavili ste lidera %s. ORG: %s",ime2,GetOrgName(ORGID));
        
SendClientMessage(playerid,-1,poruka);
        
format(poruka2,sizeof(poruka2),""COLOR_SIVA"[A-Obavijest]:{FFFFFF} %s je postavio %s leadera. ORG: %s",ime,ime2,GetOrgName(ORGID));
        
PlayerTeam[ID][ORG_Ime] = GetOrgName(ORGID);
        
PlayerTeam[ID][ORG_Leader] = 1;
    }
    return 
1;

PHP код:
stock GetOrgName(orgid)
{
    switch(
orgid)
    {
        case 
0orgid ORG_PD;
        case 
1orgid ORG_Bolnica;
        case 
2orgid ORG_News;
    }
    return 
1;

Reply
#2

What you want to return is a string, so:
PHP код:
GetOrgName(orgid

    new 
org_name[12];
    switch(
orgid
    { 
        case 
0strcat(org_name"ORG_PD"sizeof (org_name)); 
        case 
1strcat(org_name"ORG_Bolnica"sizeof (org_name));
        case 
2strcat(org_name"ORG_News"sizeof (org_name));
        default: 
strcat(org_name"N/A"sizeof (org_name));
    } 
    return 
org_name

EDIT: Also if PlayerTeam[ID][ORG_Ime] is supposed to be a string, copy it like that:
PHP код:
strcat((PlayerTeam[ID][ORG_Ime][0] = EOSPlayerTeam[ID][ORG_Ime]), GetOrgName(ORGID), 12); 
otherwise if it's not a string but an integer, you have to assign ORGID instead.
Reply
#3

PHP код:
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1438) : error 001expected token")"but found "["
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1438) : warning 215expression has no effect
C
:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1438) : error 001expected token";"but found "]"
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1438) : error 029invalid expressionassumed zero
C
:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1438) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

when i add code in command:

PHP код:
CMD:makeleader(playerid,params[])
{
    new 
ID,ime[MAX_PLAYER_NAME],ime2[MAX_PLAYER_NAME],ORGID,poruka[128],poruka2[128];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Nemate dozvolu za tu komandu");
    if(!
IsPlayerConnected(playerid)) return SendClientMessage(playerid,1,""COLOR_CRVENA"Greska:{FFFFFF} Niste ulogirani na serveru");
    if(
sscanf(params,"ud",ID,ORGID)) return SendClientMessage(playerid,-1,"{FFFFFF}Koristenje:"COLOR_LAGANA" /makeleader [ID/Ime] [OrgID]");
    if(
ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Igrac nije ulogiran na server");
    if(
ORGID || ORGID 0) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Maximum organizacija je '3'");
    else
    {
        
GetPlayerName(playerid,ime,sizeof(ime));
        
GetPlayerName(ID,ime2,sizeof(ime2));
        
format(poruka,sizeof(poruka),""COLOR_ZELENA2"[ORG-Info]:"COLOR_CRVENA" VLASNIK{FFFFFF} %s vam je postavio leadera organizacije. ORG: %s",ime,GetOrgName(ORGID));
        
SendClientMessage(ID,-1,poruka);
        
format(poruka,sizeof(poruka),""COLOR_WG"WG:{FFFFFF} Postavili ste lidera %s. ORG: %s",ime2,GetOrgName(ORGID));
        
SendClientMessage(playerid,-1,poruka);
        
format(poruka2,sizeof(poruka2),""COLOR_SIVA"[A-Obavijest]:{FFFFFF} %s je postavio %s leadera. ORG: %s",ime,ime2,GetOrgName(ORGID));
        
// strcat((PlayerTeam[ID][ORG_Ime][0] = EOS, PlayerTeam[ID][ORG_Ime]), GetOrgName(ORGID), 12);
        
PlayerTeam[ID][ORG_Leader] = 1;
    }
    return 
1;

Reply
#4

And the the error is given is the commented one?

I told you that if ORG_Ime is not a string, then assign the ORGID. Otherwise, it use the strcat and ORG_Ime needs to have a size itself.
Reply
#5

What did you just say. Im still new and that so you made me confused
ORG_Ime is string because i want to save ORG name not integer and i tried to paste that code you gave me and i got errors.
Reply
#6

Okay, sorry. What is the line 1438 which gives the errors?

Also since ORG_Ime is string, it should have a size in the enum.
Reply
#7

PHP код:
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1442) : error 001expected token")"but found "["
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1442) : warning 215expression has no effect
C
:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1442) : error 001expected token";"but found "]"
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1442) : error 029invalid expressionassumed zero
C
:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(1442) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

This are errors.

PHP код:
CMD:makeleader(playerid,params[])
{
    new 
ID,ime[MAX_PLAYER_NAME],ime2[MAX_PLAYER_NAME],ORGID,poruka[128],poruka2[128];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Nemate dozvolu za tu komandu");
    if(!
IsPlayerConnected(playerid)) return SendClientMessage(playerid,1,""COLOR_CRVENA"Greska:{FFFFFF} Niste ulogirani na serveru");
    if(
sscanf(params,"ud",ID,ORGID)) return SendClientMessage(playerid,-1,"{FFFFFF}Koristenje:"COLOR_LAGANA" /makeleader [ID/Ime] [OrgID]");
    if(
ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Igrac nije ulogiran na server");
    if(
ORGID || ORGID 0) return SendClientMessage(playerid,-1,""COLOR_CRVENA"Greska:{FFFFFF} Maximum organizacija je '3'");
    else
    {
        
GetPlayerName(playerid,ime,sizeof(ime));
        
GetPlayerName(ID,ime2,sizeof(ime2));
        
format(poruka,sizeof(poruka),""COLOR_ZELENA2"[ORG-Info]:"COLOR_CRVENA" VLASNIK{FFFFFF} %s vam je postavio leadera organizacije. ORG: %s",ime,GetOrgName(ORGID));
        
SendClientMessage(ID,-1,poruka);
        
format(poruka,sizeof(poruka),""COLOR_WG"WG:{FFFFFF} Postavili ste lidera %s. ORG: %s",ime2,GetOrgName(ORGID));
        
SendClientMessage(playerid,-1,poruka);
        
format(poruka2,sizeof(poruka2),""COLOR_SIVA"[A-Obavijest]:{FFFFFF} %s je postavio %s leadera. ORG: %s",ime,ime2,GetOrgName(ORGID));
        
strcat((PlayerTeam[ID][ORG_Ime][0] = EOSPlayerTeam[ID][ORG_Ime]), GetOrgName(ORGID), 12);
        
PlayerTeam[ID][ORG_Leader] = 1;
    }
    return 
1;

This is code.

PHP код:
strcat((PlayerTeam[ID][ORG_Ime][0] = EOSPlayerTeam[ID][ORG_Ime]), GetOrgName(ORGID), 12); 
And this is line 1442 which gives me errors.

++ This is its enum:

PHP код:
enum pTeam
{
    
ORG_Ime,
    
ORG_Rank,
    
ORG_Leader
};
new 
PlayerTeam[MAX_PLAYERS][pTeam]; 
Reply
#8

Actually I've told you how to fix it:

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
[..] ORG_Ime needs to have a size itself.
Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
[..] Also since ORG_Ime is string, it should have a size in the enum.
In the enum is used for PlayerTeam, ORG_Ime needs a size. For example:
pawn Код:
enum some_name_used_for_PlayerTeam_array
{
    ...,
    ORG_Ime[12],
    ...
};
Reply


Forum Jump:


Users browsing this thread: