help with /eject and /ejectall command -
jasonnw666 - 30.12.2009
my commands don't work i DON4T KNOW WHY..
if(strcmp(cmd,"/ejectall", true)==0)
{
new bjhgjg;
new playerstate = GetPlayerState(playerid);
bjhgjg = GetPlayerVehicleID(playerid);
if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_YELLOW,"You're not in a vehicle");
return 1;
}
if (playerstate == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"Passengers can't use This!");
return 1;
}
for (new i=0;i<MAX_PLAYERS;i++)
{
//if ((IsPlayerConnected(i))&&(IsPlayerInVehicle(i,voit ureid)))
if (IsPlayerInVehicle(i,bjhgjg))
{
RemovePlayerFromVehicle(playerid);
GameTextForPlayer(playerid,"~r~YOU'VE BEEN EJECTED!",3000,5);
return 1;
}
}
}
if(strcmp(cmd, "/eject", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new State;
if(IsPlayerInAnyVehicle(playerid))
{
State=GetPlayerState(playerid);
if(State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,COLOR_GREY," You can only eject people as the driver !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /eject [playerid/PartOfName]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
new test;
test = GetPlayerVehicleID(playerid);
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Eject yourself!"); return 1; }
if(IsPlayerInVehicle(playa,test))
{
new PName[MAX_PLAYER_NAME];
GetPlayerName(playerid,PName,sizeof(PName));
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You have thrown %s out of the car!", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You have been thrown out the car by %s !", PName);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
RemovePlayerFromVehicle(playa);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not in your Car !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Invalid ID/Name!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You need to be in a Vehicle to use this !");
}
}
return 1;
}
WWho can help me?
Thank you
Re: help with /eject and /ejectall command -
Mike Garber - 30.12.2009
I have not tested these, but;
pawn Код:
if (strcmp(cmdtext, "/eject", true)==0)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
new tmp[64];
new mycar;
new victimname[16];
mycar = GetPlayerVehicleID(playerid);
new victim;
victim = strval(tmp);
GetPlayerName(victim, victimname, sizeof(victimname));
if(IsPlayerInVehicle(victim, mycar)){
RemovePlayerFromVehicle(victim);
format(string, sizeof(string), "You have removed %s from your vehicle.",victimname);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have been removed from %s's vehicle.",playername);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}}
if (strcmp(cmdtext, "/ejectall", true)==0)
{
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
new mycar;
mycar = GetPlayerVehicleID(playerid);
for(new i=0; i<MAX_PLAYERS_; i++) {
if(IsPlayerInVehicle(i, mycar)){
RemovePlayerFromVehicle(i);
format(string, sizeof(string), "You have removed everyone from your vehicle.");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have been removed from %s's vehicle.",playername);
SendClientMessage(i, COLOR_WHITE, string);
return 1;
}}}
Re: help with /eject and /ejectall command -
jasonnw666 - 30.12.2009
thanks but when i compil i have these error
gui\gamemodes\fuiy.pwn(64747) : warning 219: local variable "playername" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64749) : warning 219: local variable "tmp" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64767) : warning 219: local variable "playername" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64771) : error 017: undefined symbol "MAX_PLAYERS_"
Re: help with /eject and /ejectall command -
Mike Garber - 30.12.2009
Quote:
Originally Posted by jasonnw666
thanks but when i compil i have these error
gui\gamemodes\fuiy.pwn(64747) : warning 219: local variable "playername" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64749) : warning 219: local variable "tmp" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64767) : warning 219: local variable "playername" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64771) : error 017: undefined symbol "MAX_PLAYERS_"
|
gui\gamemodes\fuiy.pwn(64747) : warning 219: local variable "playername" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64767) : warning 219: local variable "playername" shadows a variable at a preceding level
Fix by remove
new playername[MAX_PLAYER_NAME]; on both commands. (Means It's already defined).
gui\gamemodes\fuiy.pwn(64771) : error 017: undefined symbol "MAX_PLAYERS_"
put
pawn Код:
#define MAX_PLAYERS_ (Maxplayers)
ontop of your script.
Example:
Re: help with /eject and /ejectall command -
Deat_Itself - 30.12.2009
Quote:
Originally Posted by jasonnw666
thanks but when i compil i have these error
gui\gamemodes\fuiy.pwn(64747) : warning 219: local variable "playername" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64749) : warning 219: local variable "tmp" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64767) : warning 219: local variable "playername" shadows a variable at a preceding level
gui\gamemodes\fuiy.pwn(64771) : error 017: undefined symbol "MAX_PLAYERS_"
|
playername +tmp you used two times in your script .So remove playername + tmp from your /eject command and
Код:
for(new i=0; i<MAX_PLAYERS_; i++) {
and in /ejectall remove _ after PLAYERS so it would be like
Код:
for(new i=0; i<MAX_PLAYERS; i++)
Re: help with /eject and /ejectall command -
Mike Garber - 30.12.2009
Quote:
Originally Posted by _Saif_
playername +tmp you used two times in your script .So remove playername + tmp from your /eject command and
Код:
for(new i=0; i<MAX_PLAYERS_; i++) {
and in /ejectall remove _ after PLAYERS so it would be like
Код:
for(new i=0; i<MAX_PLAYERS; i++)
|
Yeah, that's another solution.
Re: help with /eject and /ejectall command -
jasonnw666 - 30.12.2009
sorry but i do /eject but nothing happen
i put
if (strcmp(cmdtext, "/eject", true)==0)
{
//new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e));
//new tmp[64];
new mycar;
new victimname[16];
mycar = GetPlayerVehicleID(playerid);
new victim;
victim = strval(tmp);
GetPlayerName(victim, victimname, sizeof(victimname));
if(IsPlayerInVehicle(victim, mycar)){
RemovePlayerFromVehicle(victim);
format(string, sizeof(string), "You have removed %s from your vehicle.",victimname);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have been removed from %s's vehicle.",playername);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}}
if (strcmp(cmdtext, "/ejectall", true)==0)
{
//new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playernam e));
new mycar;
mycar = GetPlayerVehicleID(playerid);
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerInVehicle(i, mycar)){
RemovePlayerFromVehicle(i);
format(string, sizeof(string), "You have removed everyone from your vehicle.");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have been removed from %s's vehicle.",playername);
SendClientMessage(i, COLOR_WHITE, string);
return 1;
}}}
Re: help with /eject and /ejectall command -
jasonnw666 - 30.12.2009
in samp 0.2 the cmd worked
if(strcmp(cmd, "/eject", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new State;
if(IsPlayerInAnyVehicle(playerid))
{
State=GetPlayerState(playerid);
if(State!=PLAYER_STATE_DRIVER)
{
SendClientMessage(playerid,COLOR_GREY," You can only eject people as the driver !");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /eject [playerid/PartOfName]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
new test;
test = GetPlayerVehicleID(playerid);
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Eject yourself!"); return 1; }
if(IsPlayerInVehicle(playa,test))
{
new PName[MAX_PLAYER_NAME];
GetPlayerName(playerid,PName,sizeof(PName));
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You have thrown %s out of the car!", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You have been thrown out the car by %s !", PName);
SendClientMessage(playa, COLOR_LIGHTBLUE, string);
RemovePlayerFromVehicle(playa);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not in your Car !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Invalid ID/Name!");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You need to be in a Vehicle to use this !");
}
}
return 1;
}
but now i think the server don't recognize that a player in a car
i use Double-O-Vehicles_PnP.inc maybe its the problem?