Help, please.
#1

Alright so, I've been working with the script for a couple of days and I've been attempting to fix it the best I can - I also asked out a few of my scripting buddies and every solution they gave ended up giving the same errors shortly after, I was wondering if anyone could possibly help.

I'm not so good with scripting, but I have little knowledge - so if anyone could explain in full detail (or anything) to give me the reason /why/ it was giving such errors, that would be great.

Here are my errors;

Quote:

C:\Documents and Settings\xxxxxxxxx\My Documents\server\gamemodes\TEST.pwn(5730) : error 017: undefined symbol "YSI_gplayerS"
C:\Documents and Settings\xxxxxxxxx\My Documents\server\gamemodes\TEST.pwn(5730) : error 017: undefined symbol "YSI_gplayerA"
C:\Documents and Settings\xxxxxxxxx\My Documents\server\gamemodes\TEST.pwn(5730) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\xxxxxxxxx\My Documents\server\gamemodes\TEST.pwn(5730) : fatal error 107: too many error messages on one line

Here is the code, too;

Quote:

stock RespawnNearbyVehicles(iPlayerID, Float: fRadius) {

new Float, Float:y, Float:z;
for( new i = 0; i < MAX_PLAYERS; i++ ) if(GetVehicleModel(i) && GetVehicleDistanceFromPoint(i, Float, Float:y, Float:z) <= fRadius) {
foreach(player, i);

if(GetPlayerVehicleID(x) == i);
SetVehicleToRespawn(i);
}
return true;
}


If you would like the command too, just ask. Thanks.
Reply
#2

pawn Код:
stock RespawnNearbyVehicles(iPlayerID, Float: fRadius)
{
    new Float: x, Float: y, Float: z;

    foreach(new i : Player)
    {
        if(GetVehicleModel(i) && GetVehicleDistanceFromPoint(i, x, y, z) <= fRadius)
        {
            if(GetPlayerVehicleID(x) == i)
            {
                SetVehicleToRespawn(i);
            }
        }
    }
   
    return true;
}
It should work now.
Reply
#3

Quote:
Originally Posted by GiamPy.
Посмотреть сообщение
pawn Код:
stock RespawnNearbyVehicles(iPlayerID, Float: fRadius)
{
    new Float: x, Float: y, Float: z;

    foreach(new i : Player)
    {
        if(GetVehicleModel(i) && GetVehicleDistanceFromPoint(i, x, y, z) <= fRadius)
        {
            if(GetPlayerVehicleID(x) == i)
            {
                SetVehicleToRespawn(i);
            }
        }
    }
   
    return true;
}
It should work now.
I have 4 more errors, however they're different ones from the before ones.

Quote:

C:\Documents and Settings\xx\My Documents\server\gamemodes\TEST.pwn(5730) : error 017: undefined symbol "foreach"
C:\Documents and Settings\xx\My Documents\server\gamemodes\TEST.pwn(5730) : error 029: invalid expression, assumed zero
C:\Documents and Settings\xx\My Documents\server\gamemodes\TEST.pwn(5730) : error 017: undefined symbol "i"
C:\Documents and Settings\xx\My Documents\server\gamemodes\TEST.pwn(5730) : fatal error 107: too many error messages on one line

Reply
#4

Quote:
Originally Posted by CharlieGamble
Посмотреть сообщение
I have 4 more errors, however they're different ones from the before ones.
If you're getting foreach undefined, make sure you have the foreach include, as well as #include <foreach> where your includes are.
Reply
#5

Quote:
Originally Posted by K9IsGodly
Посмотреть сообщение
If you're getting foreach undefined, make sure you have the foreach include, as well as #include <foreach> where your includes are.
I do; however I have suspicion it's out of date - I'll try updating foreach.inc and come back to you.

EDIT: Fixed.
Reply
#6

Also, I have noticed that

pawn Код:
if(GetPlayerVehicleID(x) == i)
does not make any sense as 'x' isn't defined anywhere (I had to define it to fix your issues, however it has a different purpose).

What are you trying to accomplish doing that?
Reply
#7

Quote:
Originally Posted by GiamPy.
Посмотреть сообщение
Also, I have noticed that

pawn Код:
if(GetPlayerVehicleID(x) == i)
does not make any sense as 'x' isn't defined anywhere (I had to define it to fix your issues, however it has a different purpose).

What are you trying to accomplish doing that?
Due to hackers sometimes (warp hacking) and sometimes people leave cars in the middle of a road and to go around 30 different vehicles destroying them, or parking them up there is a command for respawning a certain radius of vehicles - (i.e. 10 - 40) and when typing out the command, it will respawn all the vehicles in that radius. (They will be re-spawned in their originial parking places).

Here is the command;

Код:
CMD:respawncars(playerid, params[]) {
	if(PlayerInfo[playerid][pAdmin] >= 2) {
	    if(isnull(params))
	        return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /respawncars [radius]");

 		if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5)
	        return SendClientMessage(playerid, COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you

must be on-duty. Type /aduty to go on-duty.");

		new string[128], radius = strval(params);

		if((radius < 1 || radius > 40) && PlayerInfo[playerid][pAdmin] < 4)
			return SendClientMessage(playerid, COLOR_WHITE, "Radius must be higher than 0 and lower than 31!");

		RespawnNearbyVehicles(playerid, radius);
		format(string, sizeof(string), "You have respawned all vehicles within a radius of %d.", radius);
		SendClientMessage(playerid, COLOR_GREY, string);
	} else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");

	return true;
}
Reply
#8

Alright, give me a few minutes - I think I may have fixed the problem; I'll get back to you guys in a bit.

Got to edit a few things.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)