SA-MP Forums Archive
Error message? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error message? (/showthread.php?tid=367918)



Error message? - daimon567 - 11.08.2012

PHP код:
 108  public OnPlayerCommandText(playeridcmdtext[])
 
109  if (strcmp("/heal"cmdtexttrue10) == 0)
 
110  SetPlayerHealth (playerid100);
 
111     SendClientMessage (playerid0x4D34B3FF"You have healed yourself.");
 
112     return 1
I get error messages @ 109 and 112? Any ideas on what I'm doing wrong?

"Error 010: invalid function or declaration"


Re: Error message? - CoaPsyFactor - 11.08.2012

where is { after OnPlayerCommandText?


Re: Error message? - daimon567 - 11.08.2012

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
where is { after OnPlayerCommandText?
Yeah, it's there, I just removed it due to it being more simple for you to read <3 (:


Re: Error message? - CoaPsyFactor - 11.08.2012

show that code, without removing anything


Re: Error message? - Vince - 11.08.2012

Post the WHOLE thing, including ALL brackets.


Re: Error message? - CoaPsyFactor - 11.08.2012

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
show that code, without removing anything
Yea, I just said that


Re: Error message? - daimon567 - 11.08.2012

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
    {
    if(
strcmp("/kill"cmdtexttrue10) == 0)
    
SetPlayerHealth (playerid0);
    
SendClientMessage (playerid0x4D34B3FF"You have killed yourself.");
    return 
1;
    }
    {
    if (
strcmp("/heal"cmdtexttrue10) == 0)
    
SetPlayerHealth (playerid100);
    
SendClientMessage (playerid0x4D34B3FF"You have healed yourself.");
    return 
1;
    } 
Added another code ontop of the /heal. And I didn't get any error of the /kill command Wierd.


Re: Error message? - leonardo1434 - 11.08.2012

Just replace it by this.
pawn Код:
// command /heal
if(strcmp(#/heal, cmdtext)) return SetPlayerHealth(playerid, 100),SendClientMessage(playerid, 0x4D34B3FF,#You have healed yourself.);


//command /kill

if(strcmp(#/kill, cmdtext)) return SetPlayerHealth(playerid, 0),SendClientMessage(playerid, 0x4D34B3FF,#You have killed yourself.);
it should looks like this.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(#/kill, cmdtext)) return SetPlayerHealth(playerid, 0),SendClientMessage(playerid, 0x4D34B3FF,#You have killed yourself.);
    if(strcmp(#/heal, cmdtext)) return SetPlayerHealth(playerid, 100),SendClientMessage(playerid, 0x4D34B3FF,#You have healed yourself.);
    return 0;
}



Re: Error message? - daimon567 - 11.08.2012

Thanks, that seemed to fix it! +rep (:


Re: Error message? - daimon567 - 11.08.2012

Umm, this is just wierd.. Now /heal kills me, and /kill heals me. And the rest of my CMDS just kills me?