05.11.2013, 15:33
I'm making siren command for now everything is working perfect but I don't know how to make if player write /siren 3 it will remove siren?
here is my command:
You can see towards end of command
Here I don't know how to make a code to remove siren from car..
here is my command:
pawn Код:
if(strcmp(cmd, "/siren", true) == 0)
{
if(!IsPlayerCop(playerid))
{
SendClientMessage(playerid, 0xFF0000AA, "You are not authorized to use this command.");
return 1;
}
//new vehicleid = GetPlayerVehicleID(playerid);
new x_nr[256]; // number
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr))
{
SendClientMessage(playerid,0xFF0000AA,"Choose type for siren: 1 - Dashboard, 2 - Roof, 3 - Remove siren!");
return 1;
}
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be in undercover car first before using this command.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xFF0000AA, "You must be a driver to use this command.");
new vid = GetPlayerVehicleID(playerid); // ID of vehicle
for(new x = 0; x < 8; x++){
if(vid == vehicle[x]){
if(strcmp(x_nr,"1",true) == 0) // Dashboard
{
if(vid == vehicle[0]) // ZR350 1
{
AttachObjectToVehicle(object[0], vehicle[0], -0.034999, 0.434999, 0.299999, 0.000000, 0.000000, 0.000000); // Siren object at ZR350 1 on Dashboard
// ProxDetector here "(Name) grabs siren and adjust it on dashboard" or something like this..
return 1;
}
if(vid == vehicle[1]) // ZR350 2
{
AttachObjectToVehicle(object[1], vehicle[1], -0.034999, 0.434999, 0.299999, 0.000000, 0.000000, 0.000000); // Siren object at ZR350 2 on Dashboard
// ProxDetector here "(Name) grabs siren and adjust it on dashboard" or something like this..
return 1;
}
if(vid == vehicle[2]) // Sultan 1
{
AttachObjectToVehicle(object[2], vehicle[2], -0.044999, 0.804999, 0.414999, 0.000000, 0.000000, 0.000000); // Siren object at Sultan 1 on Dashboard
// ProxDetector here "(Name) grabs siren and adjust it on dashboard" or something like this..
return 1;
}
if(vid == vehicle[3]) // Sultan 2
{
AttachObjectToVehicle(object[3], vehicle[3], -0.044999, 0.804999, 0.414999, 0.000000, 0.000000, 0.000000); // Siren object at Sultan 2 on Dashboard
// ProxDetector here "(Name) grabs siren and adjust it on dashboard" or something like this..
return 1;
}
if(vid == vehicle[4]) // Virgo
{
AttachObjectToVehicle(object[4], vehicle[4], 0.000000, 0.419999, 0.304999, 0.000000, 0.000000, 0.000000); // Siren object at Virgo on Dashboard
// ProxDetector here "(Name) grabs siren and adjust it on dashboard" or something like this..
return 1;
}
if(vid == vehicle[5]) // Greenwood
{
AttachObjectToVehicle(object[5], vehicle[5], 0.000000, 0.749999, 0.384999, 0.000000, 0.000000, 0.000000); // Siren object at Greenwood on Dashboard
// ProxDetector here "(Name) grabs siren and adjust it on dashboard" or something like this..
return 1;
}
if(vid == vehicle[6]) // Tahoma
{
AttachObjectToVehicle(object[6], vehicle[6], 0.000000, 0.819999, 0.384999, 0.000000, 0.000000, 0.000000); // Siren object at Tahoma on Dashboard
// ProxDetector here "(Name) grabs siren and adjust it on dashboard" or something like this..
return 1;
}
if(vid == vehicle[7]) // Majestic
{
AttachObjectToVehicle(object[7], vehicle[7], 0.000000, 0.739999, 0.344999, 0.000000, 0.000000, 0.000000); // Siren object at Majestic on Dashboard
// ProxDetector here "(Name) grabs siren and adjust it on dashboard" or something like this..
return 1;
}
}
if(strcmp(x_nr,"2",true) == 0) // Roof
{
if(vid == vehicle[0]) // ZR350 1
{
AttachObjectToVehicle(object[0], vehicle[0], -0.469999, -0.204999, 0.749999, 0.000000, 0.000000, 0.000000); // Siren object at ZR350 1 on Roof
// ProxDetector here "(Name) grabs siren and adjust it on roof" or something like this..
return 1;
}
if(vid == vehicle[1]) // ZR350 2
{
AttachObjectToVehicle(object[1], vehicle[1], -0.469999, -0.204999, 0.749999, 0.000000, 0.000000, 0.000000); // Siren object at ZR350 2 on Roof
// ProxDetector here "(Name) grabs siren and adjust it on roof" or something like this..
return 1;
}
if(vid == vehicle[2]) // Sultan 1
{
AttachObjectToVehicle(object[2], vehicle[2], -0.564999, 0.244999, 0.859999, 0.000000, 0.000000, 0.000000); // Siren object at Sultan 1 on Roof
// ProxDetector here "(Name) grabs siren and adjust it on roof" or something like this..
return 1;
}
if(vid == vehicle[3]) // Sultan 2
{
AttachObjectToVehicle(object[3], vehicle[3], -0.564999, 0.244999, 0.859999, 0.000000, 0.000000, 0.000000); // Siren object at Sultan 2 on Roof
// ProxDetector here "(Name) grabs siren and adjust it on roof" or something like this..
return 1;
}
if(vid == vehicle[4]) // Virgo
{
AttachObjectToVehicle(object[4], vehicle[4], -0.459999, -0.140000, 0.739999, 0.000000, 0.000000, 0.000000); // Siren object at Virgo on Roof
// ProxDetector here "(Name) grabs siren and adjust it on roof" or something like this..
return 1;
}
if(vid == vehicle[5]) // Greenwood
{
AttachObjectToVehicle(object[5], vehicle[5], -0.509999, 0.135000, 0.899999, 0.000000, 0.000000, 0.000000); // Siren object at Greenwood on Roof
// ProxDetector here "(Name) grabs siren and adjust it on roof" or something like this..
return 1;
}
if(vid == vehicle[6]) // Tahoma
{
AttachObjectToVehicle(object[6], vehicle[6], -0.664999, 0.224999, 0.859999, 0.000000, 0.000000, 0.000000); // Siren object at Tahoma on Roof
// ProxDetector here "(Name) grabs siren and adjust it on roof" or something like this..
return 1;
}
if(vid == vehicle[7]) // Majestic
{
AttachObjectToVehicle(object[7], vehicle[7], -0.614999, 0.024999, 0.854999, 0.000000, 0.000000, 0.000000); // Siren object at Majestic on Roof
// ProxDetector here "(Name) grabs siren and adjust it on roof" or something like this..
return 1;
}
if(strcmp(x_nr,"3",true) == 0) // Removing siren from vehicle
{
//
}
}
return SendClientMessage(playerid, 0xFF0000AA, "You can choose only 1 - 3");
}
else{
continue;
}
}
return SendClientMessage(playerid, 0xFF0000AA, "This is not undercover vehicle");
}
return 0;
// In the end return this...
}
pawn Код:
if(strcmp(x_nr,"3",true) == 0) // Removing siren from vehicle