Error message?
#1

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"
Reply
#2

where is { after OnPlayerCommandText?
Reply
#3

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 (:
Reply
#4

show that code, without removing anything
Reply
#5

Post the WHOLE thing, including ALL brackets.
Reply
#6

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

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.
Reply
#8

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;
}
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 3 Guest(s)