SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/11/2011, 04:15 AM   #1
Kyle.
Little Clucker
 
Join Date: Oct 2010
Posts: 33
Reputation: 0
Default Script error - Please help, really basic.

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 (c) 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!
Kyle. is offline   Reply With Quote
Old 19/11/2011, 04:21 AM   #2
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,236
Reputation: 1004
Default Re: Script error - Please help, really basic.

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;
}
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 19/11/2011, 04:23 AM   #3
nmader
Gangsta
 
Join Date: Jul 2011
Posts: 639
Reputation: 52
Default Re: Script error - Please help, really basic.

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!
__________________
Script in Development
Server IP: Unavailable
Teamspeak: Unavailable
Website: Unavailable
nmader is offline   Reply With Quote
Old 19/11/2011, 04:25 AM   #4
Kyle.
Little Clucker
 
Join Date: Oct 2010
Posts: 33
Reputation: 0
Default Re: Script error - Please help, really basic.

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.
Kyle. is offline   Reply With Quote
Old 19/11/2011, 04:31 AM   #5
Kyle.
Little Clucker
 
Join Date: Oct 2010
Posts: 33
Reputation: 0
Default Re: Script error - Please help, really basic.

Actually both of them don't work, I wasn't logged into RCON and it still said repaired.
Kyle. is offline   Reply With Quote
Old 19/11/2011, 04:32 AM   #6
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,236
Reputation: 1004
Default Re: Script error - Please help, really basic.

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.
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 19/11/2011, 04:47 AM   #7
Kyle.
Little Clucker
 
Join Date: Oct 2010
Posts: 33
Reputation: 0
Default Re: Script error - Please help, really basic.

MP2 yours doesn't work either, it repairs the vehicle and says the message even when i'm not logged into RCON.
Kyle. is offline   Reply With Quote
Old 19/11/2011, 04:57 AM   #8
nmader
Gangsta
 
Join Date: Jul 2011
Posts: 639
Reputation: 52
Default Re: Script error - Please help, really basic.

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
__________________
Script in Development
Server IP: Unavailable
Teamspeak: Unavailable
Website: Unavailable
nmader is offline   Reply With Quote
Old 19/11/2011, 05:17 AM   #9
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,236
Reputation: 1004
Default Re: Script error - Please help, really basic.

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.
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 19/11/2011, 05:28 AM   #10
Kyle.
Little Clucker
 
Join Date: Oct 2010
Posts: 33
Reputation: 0
Default Re: Script error - Please help, really basic.

It works fine, but how would I make it so it only shows the message if i'm in the vehicle?
Kyle. is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SetPlayerPos, i need a basic script. Kindred Scripting Help 12 03/09/2011 11:48 PM
Help with very basic script cazz21 Help Archive 4 20/05/2011 12:33 PM
Basic features of a RP script SMCentral Help Archive 6 02/02/2010 12:17 PM
What is a Basic Police Script Function Help Archive 2 11/08/2009 09:47 PM


All times are GMT. The time now is 04:33 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.