Need help with a script -
thegamer355 - 02.01.2014
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
Re: Need help with a script -
nrg700 - 02.01.2014
ohh just add
new sendername;
Re: Need help with a script -
iOxide - 02.01.2014
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.
Re: Need help with a script -
thegamer355 - 02.01.2014
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"
Re: Need help with a script -
HK - 02.01.2014
If that doesn't work, try set the sender name[128]
Re: Need help with a script -
KingHual - 02.01.2014
This isn't PHP, you have to declare variables before using them...
Re: Need help with a script -
iOxide - 02.01.2014
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.
Re: Need help with a script -
thegamer355 - 02.01.2014
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"
Re: Need help with a script -
iOxide - 02.01.2014
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;
}
Re: Need help with a script -
thegamer355 - 02.01.2014
it only respawns the server owned vehicles not the vehicles owned by a player