Script clean up! Help!
#1

Guys im sorry for such a nooby question but im REALLY new to scripting.

Here is my issue...

I get all the following errors:

C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(611) : error 017: undefined symbol "vehicleid"
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(620) : error 017: undefined symbol "vehicleid"
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(644) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(644) : error 004: function "OnPlayerEnterVehicle" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(649) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(649) : error 004: function "OnPlayerExitVehicle" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(654) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(654) : error 004: function "OnPlayerStateChange" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(659) : warning 225: unreachable code
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(659) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(659) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(664) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(664) : error 004: function "OnPlayerLeaveCheckpoint" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(669) : warning 225: unreachable code
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(669) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(669) : error 004: function "OnPlayerEnterRaceCheckpoint" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(674) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(674) : error 004: function "OnPlayerLeaveRaceCheckpoint" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(679) : warning 225: unreachable code
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(679) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(679) : error 004: function "OnRconCommand" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(684) : warning 225: unreachable code
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(684) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(684) : error 004: function "OnPlayerRequestSpawn" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(689) : warning 225: unreachable code
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(689) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(689) : error 004: function "OnObjectMoved" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(694) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(694) : error 004: function "OnPlayerObjectMoved" is not implemented
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(699) : error 029: invalid expression, assumed zero
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(699) : error 004: function "OnPlayerPickUpPickup" is not implemented


and I think they all come from this part of the script:

public OnPlayerCommandText(playerid, cmdtext[]){

vehicleid = GetPlayerVehicleID(playerid);

if (strcmp("/nos", cmdtext, true, 10) == 0){
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0xFF0000FF,"You must be in a vehicle.");
{
if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid,0xFF0000FF,"You need $5000 to buy nos.");
{
GivePlayerMoney(playerid, -5000); // -1000
AddVehicleComponent(vehicleid, 1010); // 10x Nitro
return 1;
}
if(strcmp(cmdtext,"/help", true, 10) == 0){
SendClientMessage(playerid, DarkRed, "This is a DeathMatch/Stunt/DM server, where you can roam around and kill people!");
SendClientMessage(playerid, DarkRed, "If killing is not your thing you can also Stunt and do a number of other stuff!");
return 1;
}
if(strcmp(cmdtext,"/health", true, 10) == 0){
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, DarkRed,"Your health has been restored for 1000$!");
GivePlayerMoney(playerid, -1000);
return 1;
}
if(strcmp(cmdtext,"/armor", true, 10) == 0){
SetPlayerArmour(playerid,100);
SendClientMessage(playerid, DarkRed,"Your armor has been restored for 2000$!");
GivePlayerMoney(playerid, -2000);
return 1;
}
return 0;
}




What is so wrong here...? Please all help is apprecciated!
Reply
#2

vehicleid = GetPlayerVehicleID(playerid);
to
new vehicleid = GetPlayerVehicleID(playerid);
and
is not implemented
you missing a brackets
Reply
#3

Could you specify exactly where the bracket is missing?

EDIT: I Did something wich got rid of some of the errors, now I only have theese:

C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(611) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(613) : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(615) : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(617) : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(621) : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(623) : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(626) : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(62 : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(632) : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(634) : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(63 : error 010: invalid function or declaration
C:\Users\Joao Pedro\Desktop\Gta SA Server\gamemodes\mygamemode.pwn(640) : error 010: invalid function or declaration
Reply
#4

post script from line 611 to 640
Reply
#5

Line 611: new vehicleid = GetPlayerVehicleID(playerid)

if (strcmp("/nos", cmdtext, true, 10) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,DarkRed,"You must be in a 616 vehicle.");
{
if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid,DarkRed,"You need $5000 to buy nos.");
{
GivePlayerMoney(playerid, -5000); // -1000
AddVehicleComponent(vehicleid, 1010); // 10x Nitro
return 1;
}
if(strcmp(cmdtext,"/help", true, 10) == 0){
SendClientMessage(playerid, DarkRed, "This is a DeathMatch/Stunt/DM server, where you can roam around and kill people!");
SendClientMessage(playerid, DarkRed, "If killing is not your thing you can also Stunt and do a number of other stuff!");
return 1;
}
if(strcmp(cmdtext,"/health", true, 10) == 0){
SetPlayerHealth(playerid, 100);
SendClientMessage(playerid, DarkRed,"Your health has been restored for 1000$!");
GivePlayerMoney(playerid, -1000);
return 1;
}
if(strcmp(cmdtext,"/armor", true, 10) == 0){
SetPlayerArmour(playerid,100);
SendClientMessage(playerid, DarkRed,"Your armor has been restored for 2000$!");
GivePlayerMoney(playerid, -2000);
return 1;
}
Line 640: return 0;


I didint put in all the line number... that would take me alot of time ;S you can do the maths, i put the first and last.
Reply
#6

put the code in pawn bbcode
Reply
#7

Код:
new vehicleid = GetPlayerVehicleID(playerid)
    
        if (strcmp("/nos", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,DarkRed,"You must be in a vehicle.");
        {
            if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid,DarkRed,"You need $5000 to buy nos.");
            {
                GivePlayerMoney(playerid, -5000); // -1000
                AddVehicleComponent(vehicleid, 1010); // 10x Nitro
                return 1;
}
       if(strcmp(cmdtext,"/help", true, 10) == 0){
       SendClientMessage(playerid, DarkRed, "This is a DeathMatch/Stunt/DM server, where you can roam around and kill people!");
       SendClientMessage(playerid, DarkRed, "If killing is not your thing you can also Stunt and do a number of other stuff!");
       return 1;
}
	if(strcmp(cmdtext,"/health", true, 10) == 0){
	   SetPlayerHealth(playerid, 100);
	   SendClientMessage(playerid, DarkRed,"Your health has been restored for 1000$!");
	   GivePlayerMoney(playerid, -1000);
	   return 1;
}
	if(strcmp(cmdtext,"/armor", true, 10) == 0){
	   SetPlayerArmour(playerid,100);
	   SendClientMessage(playerid, DarkRed,"Your armor has been restored for 2000$!");
	   GivePlayerMoney(playerid, -2000);
	   return 1;
}
  return 0;
I dont know what you mean by Pawn BB Code but I assume it's this maybe?
Reply
#8

You forgot a
Код:
;
after GetPlayerVehicleID
Also you forgot else after !IsPlayerInAnyVehicle

There is a huge problem of
Код:
{}
.. lol

next time take care of braces.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new vehicleid = GetPlayerVehicleID(playerid);

	if (strcmp("/nos", cmdtext, true, 10) == 0)
	{
		if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,DarkRed,"You must be in a 616 vehicle.");
		else
		{
			if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid,DarkRed,"You need $5000 to buy nos.");
			else
			{
			    GivePlayerMoney(playerid, -5000); // -1000
				AddVehicleComponent(vehicleid, 1010); // 10x Nitro
			}
		}
		return 1;
	}
	
	if(strcmp(cmdtext,"/help", true, 10) == 0){
	SendClientMessage(playerid, DarkRed, "This is a DeathMatch/Stunt/DM server, where you can roam around and kill people!");
	SendClientMessage(playerid, DarkRed, "If killing is not your thing you can also Stunt and do a number of other stuff!");
	return 1;
	}
	if(strcmp(cmdtext,"/health", true, 10) == 0){
	SetPlayerHealth(playerid, 100);
	SendClientMessage(playerid, DarkRed,"Your health has been restored for 1000$!");
	GivePlayerMoney(playerid, -1000);
	return 1;
	}
	if(strcmp(cmdtext,"/armor", true, 10) == 0){
	SetPlayerArmour(playerid,100);
	SendClientMessage(playerid, DarkRed,"Your armor has been restored for 2000$!");
	GivePlayerMoney(playerid, -2000);
	return 1;
	}

	return 0;
}
Reply
#9

Thank you! Problem solved
Reply
#10

Guys one more thing.

When I do the /armor or /health command, it takes me money. But i dont want it so it goes negative. I want the server to tell the player he hasnt got enough money. How do I do that?

Код:
if(strcmp(cmdtext,"/health", true, 10) == 0){
	SetPlayerHealth(playerid, 100);
	SendClientMessage(playerid, DarkRed,"Your health has been restored for $1000!");
	GivePlayerMoney(playerid, -1000);
	return 1;
	}
	if(strcmp(cmdtext,"/armor", true, 10) == 0){
	SetPlayerArmour(playerid,100);
	SendClientMessage(playerid, DarkRed,"Your armor has been restored for 2000$!");
	GivePlayerMoney(playerid, -2000);
	return 1;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)