Need help with a script
#1

Hi all,

i am new to this forum and this is my first topic.
anyways i am using this script as a .include
hope someone can help me

Код:
COMMAND:rc(playerid,params[])
{
	if(APlayerData[playerid][PlayerLevel] < 1) return SendClientMessage(playerid, 0xFF0000FF, "You are not authorized to use that command!");
	for(new car = 1; car <= 268; car++)
	{
		if(IsVehicleEmpty(car)) SetVehicleToRespawn(car);
	}
	GetPlayerName(playerid, sendername, sizeof(sendername));
	format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
	BroadCast(0xFFFFFFFF,string);
	return 1;
}

stock IsVehicleEmpty(vehicleid)
{
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerInVehicle(i, vehicleid)) return 0;
	}
	return 1;
}
but i get these errors:
Код:
D:\games\gta trucking server\pawno\include\thegamer_PlayerCommands.inc(4913) : error 017: undefined symbol "sendername"
D:\games\gta trucking server\pawno\include\thegamer_PlayerCommands.inc(4913) : error 017: undefined symbol "sendername"
D:\games\gta trucking server\pawno\include\thegamer_PlayerCommands.inc(4913) : error 029: invalid expression, assumed zero
D:\games\gta trucking server\pawno\include\thegamer_PlayerCommands.inc(4913) : fatal error 107: too many error messages on one line
Reply
#2

ohh just add
new sendername;
Reply
#3

pawn Код:
COMMAND:rc(playerid,params[])
{
    new sendername[24], string[128];
    if(APlayerData[playerid][PlayerLevel] < 1) return SendClientMessage(playerid, 0xFF0000FF, "You are not authorized to use that command!");
    for(new car = 1; car <= 268; car++)
    {
        if(IsVehicleEmpty(car)) SetVehicleToRespawn(car);
    }
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
    BroadCast(0xFFFFFFFF,string);
    return 1;
}

stock IsVehicleEmpty(vehicleid)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerInVehicle(i, vehicleid)) return 0;
    }
    return 1;
}
Try that.
Reply
#4

i still get these errors
Код:
D:\games\gta trucking server\pawno\include\thegamer_PlayerCommands.inc(4909) : warning 217: loose indentation
D:\games\gta trucking server\pawno\include\thegamer_PlayerCommands.inc(4916) : error 017: undefined symbol "BroadCast"
Reply
#5

If that doesn't work, try set the sender name[128]
Reply
#6

This isn't PHP, you have to declare variables before using them...
Reply
#7

Quote:
Originally Posted by HK
Посмотреть сообщение
If that doesn't work, try set the sender name[128]
Why would he need to put the array size to 128? It really doesn't matter as it depends on the command usage by the player.


Ontopic: What does BroadCast do for you? If you want to send message to all the players, just simply use SendClientMessageToAll. And that loose intentation is because you don't have one line at the correct position. Check the line that is giving loose intetntaion warning and fix the position.
Reply
#8

when i have
Код:
 new sendername[128], string[128];
then i have these errors
Код:
D:\games\gta trucking server\pawno\include\thegamer_PlayerCommands.inc(4909) : warning 217: loose indentation
D:\games\gta trucking server\pawno\include\thegamer_PlayerCommands.inc(4916) : error 017: undefined symbol "BroadCast"
Reply
#9

Well try this one:

pawn Код:
COMMAND:rc(playerid,params[])
{
    new sendername[24], string[128];
    if(APlayerData[playerid][PlayerLevel] < 1) return SendClientMessage(playerid, 0xFF0000FF, "You are not authorized to use that command!");
    for(new car = 1; car <= 268; car++)
    {
        if(IsVehicleEmpty(car)) SetVehicleToRespawn(car);
    }
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "SERVER: All unused cars respawned by %s.", sendername);
    SendClientMessageToAll(0xFFFFFFFF,string);
    return 1;
}

stock IsVehicleEmpty(vehicleid)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerInVehicle(i, vehicleid)) return 0;
    }
    return 1;
}
Reply
#10

it only respawns the server owned vehicles not the vehicles owned by a player
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)