Problem with script.
#1

Hello. I was making my admin script and i get some error when compile it:

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
//===========================( Admin komande )===========================
COMMAND:setlevel(playerid,params[])
{
   new 
id,level,msg[128],msg2[128],name[MAX_PLAYER_NAME];
   if(
IsPlayerAdmin(playerid))
   {
       if(
sscanf(params,"ud",id,level)) return SendClientMessage(playerid0xFFFFFF,"Koristenje: /setlevel (Ime/ID) (Level)");
       else if(
level 5) return SendClientMessage(playerid0xFFFFFF,"Error: Maximalni level admin je 5.");
       else
       {
           
PlayerInfo[id][pAdministrator] = level;
           
format(msg,sizeof(msg),"Cestitamo! Sada ste admin na levelu %d",level);
           
SendClientMessage(id,0xFFFFFF,msg);
           
GetPlayerName(id,name,sizeof(name));
           
format(msg2,sizeof(msg2),"Postavili ste admina %s na levelu %d"name,level);
           
SendClientMessage(playerid,0xFFFFFF,msg2);
       }
       
    }
    else
    {
            
SendClientMessage(playerid,0xFFFFFF,"Error: Nemate dozvolu za tu komandu!");
    }
    return 
1;
     

I really don't know what is the problem. First it was in brackets (10 errors),and i fixed it and I am still thinking that it is problem in brackets ? :P

PHP код:
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(216) : error 029invalid expressionassumed zero
C
:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(238) : warning 217loose indentation
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Error

PHP код:
COMMAND:setlevel(playerid,params[]) 
<-- 216 line
Reply
#2

Dont use zcmd inside OnPlayerCommandText, use it for itself, as it works like a public function.
Only use OnPlayerCommandText for strcmp commands.
Reply
#3

Read the documentation on ZCMD here: https://sampforum.blast.hk/showthread.php?tid=91354
Try to understand how callbacks work and how to create your command. Also, you will have to rename your OnPlayerCommandText callback according to what the documentation says.
Reply
#4

Thank you guys so much
Reply
#5

What in the hell is this ?
public OnPlayerCommandText(playerid, cmdtext[]) // yOU CAN TAKE OUT IT.. with all { and } it aint needed if you are using zcmd command procesor.. + don't put it under it.

This aint needed if you are using ZCMD.. + no brackets..
Reply
#6

He's already gotten an answer for that.
Reply
#7

Hey guyz but i have a new problem. Everything in the script works now and when i launch samp and try to type the command,nothing shows if u know what i mean...

PHP код:
CMD:PostaviAdmina(playerid,params[])
{
    new 
id,level,msg[128],msg2[128],name[MAX_PLAYER_NAME];
    if(
IsPlayerAdmin(playerid))
    if(
sscanf(params,"ud",id,level)) return SendClientMessage(playerid0xFFFFFF,"Koristenje: /setlevel (Ime/ID) (Level)");
            else if(
level 5) return SendClientMessage(playerid0xFFFFFF,"Error: Maximalni level admin je 5.");
            else
            
PlayerInfo[id][pAdministrator] = level;
            
format(msg,sizeof(msg),"Cestitamo! Sada ste admin na levelu %d",level);
            
SendClientMessage(id,0xFFFFFF,msg);
            
GetPlayerName(id,name,sizeof(name));
            
format(msg2,sizeof(msg2),"Postavili ste admina %s na levelu %d"name,level);
            
SendClientMessage(playerid,0xFFFFFF,msg2);
            else
            
SendClientMessage(playerid,0xFFFFFF,"Error: Nemate dozvolu za tu komandu!");
            return 
1;

I made this when you told me that i don't need to use brackets in it.

PHP код:
C:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(415) : warning 217loose indentation
C
:\Users\Dino Covic\Desktop\SAMP Server\gamemodes\Server_Skripta.pwn(420) : error 029invalid expressionassumed zero
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
1 Error

And i get this error!
Reply
#8

If someone help i would +rep
Reply
#9

You shouldn't remove the brackets, leave them as it is.
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You're not an admin");
Reply
#10

Yea but when I type command nothing doesn't show?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)