Script error - Please help, really basic.
#1

I'm new to PAWNO and i'm trying to teach myself, this is why I don't know why I am getting this error.

Code:
		if(strcmp(cmdtext,"/fv",true) == 0)
	{
	    if IsPlayerAdmin(playerid)SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
	    if IsPlayerAdmin(playerid)RepairVehicle(GetPlayerVehicleID(playerid));
	    if IsPlayerAdmin(playerid)SendClientMessage(playerid,RED,"ADMIN: Your vehicle has been repaired.");
		else SendClientMessage(playerid,RED,"ERROR: This is an Admin only command.");
		return 1;
	}
The error is:

Quote:

C:\Users\Kyle\Desktop\PAWNO\gamemodes\gurp.pwn(212 4) : error 001: expected token: "*then", but found "-identifier-"
C:\Users\Kyle\Desktop\PAWNO\gamemodes\gurp.pwn(212 5) : error 001: expected token: "*then", but found "-identifier-"
C:\Users\Kyle\Desktop\PAWNO\gamemodes\gurp.pwn(212 6) : error 001: expected token: "*then", but found "-identifier-"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

And the lines are starting from the top:

2122 if(strcmp(cmdtext) ETCCC..
2123 {
2124 If isplayerEtc SetVehicleHealth etc..
2125 If isplayeretc RepairVehicle Etc
2126 if Isplayeretc SendClientMessage
2127 else SendClientMessage ETC..
2128 return 1;
2129
2130 return 0;


Please help i'm and explain what I did wrong would be great!
Reply
#2

pawn Code:
if(strcmp(cmdtext,"/fv",true) == 0)
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "ERROR: This is an admin only command.");
    SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid,RED,"ADMIN: Your vehicle has been repaired.");
    return 1;
}
Reply
#3

From what I see, this may do it, try changing to this:

Code:
	if(strcmp(cmdtext,"/fv",true) == 0)
	{
	    if (IsPlayerAdmin(playerid)SetVehicleHealth(GetPlayerVehicleID(playerid), 1000)));
            {
	            if (IsPlayerAdmin(playerid)RepairVehicle(GetPlayerVehicleID(playerid)));
                    {
	                   if (IsPlayerAdmin(playerid)SendClientMessage(playerid,RED,"ADMIN: Your vehicle has been repaired."));
		    }
                    else 
                    {
                    SendClientMessage(playerid,RED,"ERROR: This is an Admin only command.");
                    }
              }
              return 1;
	}
Lemme know if this works or not, I want to help as much as possible!
Reply
#4

Quote:
Originally Posted by MP2
View Post
pawn Code:
if(strcmp(cmdtext,"/fv",true) == 0)
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "ERROR: This is an admin only command.");
    SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid,RED,"ADMIN: Your vehicle has been repaired.");
    return 1;
}
This one worked perfectly, thanks nmader, your should work too, but he was first. Thanks alot guys, I see what I did wrong.
Reply
#5

Actually both of them don't work, I wasn't logged into RCON and it still said repaired.
Reply
#6

nmader's is extremely in-efficient; why check if they are admin 3 times..? Also look at it, it wouldn't even display the message for non-admins.
Reply
#7

MP2 yours doesn't work either, it repairs the vehicle and says the message even when i'm not logged into RCON.
Reply
#8

I simply gave the code he had provided MP2, I simply editted it to make it look more correct, may I note you, that I am not the worlds best scripter, as you can see, but you are not perfect either MP2, and Kyle, honestly, at this point, I am honestly not sure, my apologies
Reply
#9

Quote:
Originally Posted by Kyle.
View Post
MP2 yours doesn't work either, it repairs the vehicle and says the message even when i'm not logged into RCON.
Clearly you ARE logged in to RCON, haven't updated the script properly or have made a different mistake because the code is extremely straightforward.
Reply
#10

It works fine, but how would I make it so it only shows the message if i'm in the vehicle?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)