help please( good scripters) -
Rafaeloo - 02.09.2016
Hello guys
i have an spawn/despawn vehicle system.
the command is /vstorage and all players can use it.
i want to do something for this, if a player is seat on vehicle you cant despawn the vehicle but i dont know how to do it
please any one help me i will rep :/
Command:
Код:
CMD:vstorage(playerid, params[])
{
if(AdminDuty[playerid] == 1)
{
SendClientMessage(playerid,COLOR_WHITE, "You can't use this command while on-duty as admin.");
return 1;
}
new vstring[1024];
for(new i, iModelID; i < MAX_PLAYERVEHICLES; i++) {
if((iModelID = PlayerVehicleInfo[playerid][i][pvModelId] - 400) >= 0) {
if(PlayerVehicleInfo[playerid][i][pvImpounded]) {
format(vstring, sizeof(vstring), "%s\n%s (impounded)", vstring, VehicleName[iModelID]);
}
else if(PlayerVehicleInfo[playerid][i][pvDisabled]) {
format(vstring, sizeof(vstring), "%s\n%s (disabled)", vstring, VehicleName[iModelID]);
}
else if(!PlayerVehicleInfo[playerid][i][pvSpawned]) {
format(vstring, sizeof(vstring), "%s\n%s (stored)", vstring, VehicleName[iModelID]);
}
else format(vstring, sizeof(vstring), "%s\n%s (spawned)", vstring, VehicleName[iModelID]);
}
else strcat(vstring, "\nEmpty");
}
ShowPlayerDialogEx(playerid, VEHICLESTORAGE, DIALOG_STYLE_LIST, "Vehicle storage", vstring, "(De)spawn", "Cancel");
return 1;
}
Please help me :/
Re: help please( good scripters) -
Rafaeloo - 02.09.2016
please guyss
Respuesta: help please( good scripters) -
HidroDF - 02.09.2016
Add
Код:
if(!IsVehicleEmpty(i)) return SendClientMessage(playerid,COLOR_WHITE, "The vehicle is occuped.");
Like:
Код:
CMD:vstorage(playerid, params[])
{
if(AdminDuty[playerid] == 1)
{
SendClientMessage(playerid,COLOR_WHITE, "You can't use this command while on-duty as admin.");
return 1;
}
new vstring[1024];
for(new i, iModelID; i < MAX_PLAYERVEHICLES; i++) {
if(!IsVehicleEmpty(i)) return SendClientMessage(playerid,COLOR_WHITE, "The vehicle is occuped.");
if((iModelID = PlayerVehicleInfo[playerid][i][pvModelId] - 400) >= 0) {
if(PlayerVehicleInfo[playerid][i][pvImpounded]) {
format(vstring, sizeof(vstring), "%s\n%s (impounded)", vstring, VehicleName[iModelID]);
}
else if(PlayerVehicleInfo[playerid][i][pvDisabled]) {
format(vstring, sizeof(vstring), "%s\n%s (disabled)", vstring, VehicleName[iModelID]);
}
else if(!PlayerVehicleInfo[playerid][i][pvSpawned]) {
format(vstring, sizeof(vstring), "%s\n%s (stored)", vstring, VehicleName[iModelID]);
}
else format(vstring, sizeof(vstring), "%s\n%s (spawned)", vstring, VehicleName[iModelID]);
}
else strcat(vstring, "\nEmpty");
}
ShowPlayerDialogEx(playerid, VEHICLESTORAGE, DIALOG_STYLE_LIST, "Vehicle storage", vstring, "(De)spawn", "Cancel");
return 1;
}
Re: help please( good scripters) -
Rafaeloo - 02.09.2016
where? which line of the vstorage cmd bro
sorry for eng
Respuesta: help please( good scripters) -
HidroDF - 02.09.2016
Added line 10. Checks if there's anyone inside the car. If it's occiuped will show the message "The vehicle is occiuped." and won't be stored because there's a player seat, driving the car or something else.
Re: help please( good scripters) -
Rafaeloo - 02.09.2016
thank you so much bro _+repped
Re: help please( good scripters) -
Rafaeloo - 02.09.2016
undefined symbol "IsVehicleEmpty" ??
Respuesta: help please( good scripters) -
HidroDF - 02.09.2016
Sorry. Add this to your script:
Код:
stock IsVehicleEmpty(vehicleid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, vehicleid)) return 0;
}
return 1;
}
Re: help please( good scripters) -
Rafaeloo - 02.09.2016
thanks you bro worked
Re: help please( good scripters) -
Rafaeloo - 02.09.2016
bro i put the gm in server, but i can despawn my car when a other player is in the car?