I need help with a command
#1

Hello, I'm new on the forum so I don't know the rules and all that stuff, but anyways, I need help with a command here.
This is the code:

Код:
521  YCMD:aduty(playerid, params[], help)
522  {
523 	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, CRVENA, "LH | {FFFFFF}Niste 
        admin.");
524	new string[256];
525	if(AdminDuty[playerid] == 0)
526	{
527	    format(string,sizeof(string), ""CRVENA"LH | {F3F707}Admin {FF0000}%s {F3F707}je na duћnosti, za 
            pomoć kucajte /pitaj.", GetName(playerid));
528	    SendAdminMessage(-1, string);
529	    AdminDuty[playerid] = 1;
530	    God[playerid] = 1;
531	    SetPlayerColor(playerid, COLOR_PURPLE);
532	    SetPlayerArmour(playerid, 99.0);
533	}
534	else if(AdminDuty[playerid] == 1)
535	{
536	    SetPlayerArmour(playerid, 0);
537	    format(string, sizeof(string), ""CRVENA"LH | {F3F707}Admin {FF0000}%s {F3F707}viљe nije na duћnosti."),GetName(playerid);
538	    AdminDuty[playerid] = 0;
539	    SetPlayerColor(playerid, BIJELA);
540	}
541	return 1;
542  }
(the lines that don't have numbers in front of them, they should be on the line above them, but it couldn't fit)
Here are the errors I'm getting:

Код:
C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(527) : error 001: expected token: "-string end-", but found "-identifier-"

C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(527) : warning 215: expression has no effect

C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(527) : error 001: expected token: ";", but found "-string-"

C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(527) : warning 215: expression has no effect

C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(527) : error 012: invalid function call, not a valid address

C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(527) : fatal error 107: too many error messages on one line
I'm also new in scripting, so every help will be appreciated, thank you!
Reply
#2

Try this.
PHP код:
 YCMD:aduty(playeridparams[], help)
  {
    new 
string[256];
      if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCRVENA"LH | {FFFFFF}Niste admin.");
    if(
AdminDuty[playerid] == 0)
    {
     
format(string,sizeof(string), "{FF0000} LH | {F3F707}Admin {FF0000}%s {F3F707}je na dužnosti, za pomoc kucajte /pitaj."GetName(playerid));
    
SendAdminMessage(-1string);
    
AdminDuty[playerid] = 1;
    
God[playerid] = 1;
    
SetPlayerColor(playeridCOLOR_PURPLE);
    
SetPlayerArmour(playerid99.0);
}
    else if(
AdminDuty[playerid] == 1)
    {
        
SetPlayerArmour(playerid0);
        
format(stringsizeof(string), "{FF0000} LH | {F3F707}Admin {FF0000}%s {F3F707}više nije na dužnosti."),GetName(playerid);
        
AdminDuty[playerid] = 0;
        
SetPlayerColor(playeridBIJELA);
    }
    return 
1;

Reply
#3

If you have a long text you can split the last parameters after the "," in the second line.

And 256 cells is too much for that.
Reply
#4

PHP код:
 YCMD:aduty(playeridparams[], help)
  {
    new 
string[120];
    if(
PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playeridCRVENA"LH | {FFFFFF}Niste admin.");
    switch(
AdminDuty[playerid]) 
    {
        case 
0
        {
            
format(stringsizeof string""CRVENA"LH | {F3F707}Admin {FF0000}%s {F3F707}je na dužnosti, za pomoć kucajte /pitaj."GetName(playerid));
            
SendAdminMessage(-1string);
            
AdminDuty[playerid] = 1;
            
God[playerid] = 1;
            
SetPlayerColor(playeridCOLOR_PURPLE);
            
SetPlayerArmour(playerid99.0);

        } 
        case 
1
        {
            
SetPlayerArmour(playerid0);
            
format(stringsizeof string""CRVENA"LH | {F3F707}Admin {FF0000}%s {F3F707}više nije na dužnosti."GetName(playerid));
            
AdminDuty[playerid] = 0;
            
SetPlayerColor(playeridBIJELA);
        }

    }
    return 
true;

Reply
#5

I just changed the "GetName" in lines 554 and 563 with "GetPlayerName", and deleted the "SendAdminMessage(-1, string);".

Now I'm getting these warnings:
Quote:

C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(553) : warning 202: number of arguments does not match definition
C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(553) : warning 202: number of arguments does not match definition
C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(562) : warning 202: number of arguments does not match definition
C:\Users\Nautilus\Desktop\Sve za SAMP\Last Hope ORIGINAL\gamemodes\LHope.pwn(562) : warning 202: number of arguments does not match definition

Here are the lines again:
Quote:

547 YCMD:aduty(playerid, params[], help)
548 {
549 new string[256];
550 if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, CRVENA, "LH | {FFFFFF}Niste
551 admin.");
552 if(AdminDuty[playerid] == 0)
553 {
554 format(string,sizeof(string), "{FF0000} LH | {F3F707}Admin {FF0000}%s {F3F707}je na duћnosti, za
pomoc kucajte /pitaj.", GetPlayerName(playerid));
555 AdminDuty[playerid] = 1;
556 God[playerid] = 1;
557 SetPlayerColor(playerid, COLOR_PURPLE);
558 SetPlayerArmour(playerid, 99.0);
559 }
560 else if(AdminDuty[playerid] == 1)
561 {
562 SetPlayerArmour(playerid, 0);
563 format(string, sizeof(string), "{FF0000} LH | {F3F707}Admin {FF0000}%s {F3F707}viљe nije na
duћnosti.",GetPlayerName(playerid));
564 AdminDuty[playerid] = 0;
565 SetPlayerColor(playerid, BIJELA);
566 }
567 return 1;
568 }

Reply
#6

Add this a line above "if(AdminDuty[playerid]==0)":

new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));

Then replace "GetPlayerName(playerid));" where the error lines are to: name

Therefore, it should look like this:

554 format(string,sizeof(string), "{FF0000} LH | {F3F707}Admin {FF0000}%s {F3F707}je na duћnosti, za
pomoc kucajte /pitaj.", name);

and

563 format(string, sizeof(string), "{FF0000} LH | {F3F707}Admin {FF0000}%s {F3F707}viљe nije na
duћnosti.", name);

Код:
547 YCMD:aduty(playerid, params[], help)
548 {
549 new string[256];
550 if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, CRVENA, "LH | {FFFFFF}Niste 
551 admin.");
*** new name[MAX_PLAYER_NAME];
*** GetPlayerName(playerid, name, sizeof(name));
552 if(AdminDuty[playerid] == 0)
553 {
554	format(string,sizeof(string), "{FF0000} LH | {F3F707}Admin {FF0000}%s {F3F707}je na duћnosti, za 
pomoc kucajte /pitaj.", name);
555	AdminDuty[playerid] = 1;
556	God[playerid] = 1;
557	SetPlayerColor(playerid, COLOR_PURPLE);
558	SetPlayerArmour(playerid, 99.0);
559 }
560 else if(AdminDuty[playerid] == 1)
561 {
562 SetPlayerArmour(playerid, 0);
563 format(string, sizeof(string), "{FF0000} LH | {F3F707}Admin {FF0000}%s {F3F707}viљe nije na 
duћnosti.", name);
564 AdminDuty[playerid] = 0;
565 SetPlayerColor(playerid, BIJELA);
566 }
567 return 1;
568 }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)