Script Request Thread #4
#21

Quote:
Originally Posted by jameskmonger
Put this at the VERY BOTTOM of your script.
Код:
stock DestroyAllVehicles()
{
for(new i;i<MAX_VEHICLES;i++)SetVehicleToRespawn(i);
}
By the way, check my sig.
When i put the comamnd with that, CPU usage increases a while and then goes normally, but spawned cars still there.

Quote:
Originally Posted by Don Correlli
Use this one:
Quote:
Originally Posted by Don Correlli
pawn Код:
stock DestroyAllVehicles()
{
  for(new v = 1; v <= MAX_VEHICLES; v++) DestroyVehicle(v);
}
Why?
Quote:
Originally Posted by Don Correlli
because vehicleID starts with 1
And with that, just all cars dissapear.
Reply
#22

Well, you wanted to destroy them, didn't you?
Reply
#23

Quote:
Originally Posted by Don Correlli
Well, you wanted to destroy them, didn't you?
Huh, you dindnt understand me sorry if im expressing bad.

What I want is to "destroy" spawned cars with the command /carname (ex: /jester, /turismo), and the other cars (AddStaticVehicles) just respawn to their normal site. Hope you can understand me now
Thanks!
Reply
#24

Quote:
Originally Posted by Fedee!
Quote:
Originally Posted by Don Correlli
Well, you wanted to destroy them, didn't you?
Huh, you dindnt understand me sorry if im expressing bad.

What I want is to "destroy" spawned cars with the command /carname (ex: /jester, /turismo), and the other cars (AddStaticVehicles) just respawn to their normal site. Hope you can understand me now
Thanks!
Код:
stock RespawnAllVehicles()
{
  for(new X = 1; X <= sizeof(SawnedVehicles); X++) if(SpawnedVehicles[X] != 0)DestroyVehicle(SpawnedVehicles[X]);
 //change SpawnedVehicles to the variable where you save your spawned vehicles
  for(new v = 1; v <= MAX_VEHICLES; v++) SetVehicleToRespawn(v);

}
EDIT: Never mind, it was someone with the same name
Reply
#25

Quote:
Originally Posted by GTAguillaume
BTW: i guess i saw you hacking in SFR -.-
??

I got these errors:

Quote:

C:\Documents and Settings\Feche!\Escritorio\Server SAMP\filterscripts\respawn.pwn(42) : error 017: undefined symbol "SpawnedVehicles"
C:\Documents and Settings\Feche!\Escritorio\Server SAMP\filterscripts\respawn.pwn(42) : error 036: empty statement
C:\Documents and Settings\Feche!\Escritorio\Server SAMP\filterscripts\respawn.pwn(42) : error 017: undefined symbol "X"
C:\Documents and Settings\Feche!\Escritorio\Server SAMP\filterscripts\respawn.pwn(42) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Sorry im benginner.
Reply
#26

Re-Bump
Peace
Quote:
Originally Posted by [NWA
Hannes ]
Bump lol..
Quote:

Hey, I'm looking for a gangchat command for example /gc [Text], I think I have what you pro scripters need to make it work :P

Heres that thingy you know :P
Код:
for(new i = 0; i < gangInfo[gangnum][1]; i++)
This is what it's going to send message to
Код:
gangMembers[gangnum][i]
Hope you can make it work :P
Thanks

Reply
#27

Change SpawnedVehicles to the variable where you save your spawned vehicles
Код:
stock RespawnAllVehicles()
{
  for(new X; X <= sizeof(SpawnedVehicles); X++) if(SpawnedVehicles[X] != 0) DestroyVehicle(SpawnedVehicles[X]);
  for(new v = 1; v <= MAX_VEHICLES; v++) SetVehicleToRespawn(v);

}
If you dont save your spawned vehicle ID's:
Код:
new SpawnedVehicles[200]; //change 200 to the max spawned vehicles
Код:
if (!strcmp("/turismo", cmd, true)) //change /turismo to the command
{
for(new i;i<sizeof(SpawnedVehicles);i++) 
{
if(SpawnedVehicles[i] == 0)
{
new Float:X,Float:Y,Float:Z,Float:ROT;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerAngle(playerid,ROT
SpawnedVehicles[i] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2); //change MODEL,COLOR1 and COLOR2
return 1;
}
return 1
}
Reply
#28

Quote:
Originally Posted by GTAguillaume
Change SpawnedVehicles to the variable where you save your spawned vehicles
Код:
stock RespawnAllVehicles()
{
  for(new X; X <= sizeof(SpawnedVehicles); X++) if(SpawnedVehicles[X] != 0) DestroyVehicle(SpawnedVehicles[X]);
  for(new v = 1; v <= MAX_VEHICLES; v++) SetVehicleToRespawn(v);

}
If you dont save your spawned vehicle ID's:
Код:
new SpawnedVehicles[200]; //change 200 to the max spawned vehicles
Код:
if (!strcmp("/turismo", cmd, true)) //change /turismo to the command
{
for(new i;i<sizeof(SpawnedVehicles);i++) 
{
if(SpawnedVehicles[i] == 0)
{
new Float:X,Float:Y,Float:Z,Float:ROT;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerAngle(playerid,ROT
SpawnedVehicles[i] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2); //change MODEL,COLOR1 and COLOR2
return 1;
}
return 1
}
Humm, thats to respawn cars or to spawn a car?
Reply
#29

RespawnAllVehicles() respawn all cars, and it destroy all spawned cars, but you will need to save all spawned cars. (Sorry for my english )
Reply
#30

Quote:
Originally Posted by GTAguillaume
RespawnAllVehicles() respawn all cars, and it destroy all spawned cars, but you will need to save all spawned cars. (Sorry for my english )
Humm.. its more harder than what i thinked.. how can i save spawned cars?
Reply
#31

Quote:
Originally Posted by Fedee!
Quote:
Originally Posted by GTAguillaume
RespawnAllVehicles() respawn all cars, and it destroy all spawned cars, but you will need to save all spawned cars. (Sorry for my english )
Humm.. its more harder than what i thinked.. how can i save spawned cars?
With somthing like this:
Код:
new SpawnedVehicles[200]; //change 200 to the max spawned vehicles
Код:
if (!strcmp("/turismo", cmd, true))
{
for(new i;i<sizeof(SpawnedVehicles);i++) 
{
if(SpawnedVehicles[i] == 0)
{
new Float:X,Float:Y,Float:Z,Float:ROT;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerAngle(playerid,ROT);
SpawnedVehicles[i] = CreateVehicle(451,X,Y,Z,ROT,1,1);
SendClientMessage(playerid,0x00ff00AA,"You spawned succesfull a turismo!");
return 1;
}
return 1
}
Reply
#32

Quote:
Originally Posted by GTAguillaume
Quote:
Originally Posted by Fedee!
Quote:
Originally Posted by GTAguillaume
RespawnAllVehicles() respawn all cars, and it destroy all spawned cars, but you will need to save all spawned cars. (Sorry for my english )
Humm.. its more harder than what i thinked.. how can i save spawned cars?
With somthing like this:
Код:
new SpawnedVehicles[200]; //change 200 to the max spawned vehicles
Код:
if (!strcmp("/turismo", cmd, true))
{
for(new i;i<sizeof(SpawnedVehicles);i++) 
{
if(SpawnedVehicles[i] == 0)
{
new Float:X,Float:Y,Float:Z,Float:ROT;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerAngle(playerid,ROT);
SpawnedVehicles[i] = CreateVehicle(451,X,Y,Z,ROT,1,1);
SendClientMessage(playerid,0x00ff00AA,"You spawned succesfull a turismo!");
return 1;
}
return 1
}
I must do that for every car model right?
Reply
#33

Quote:

I must do that for every car model right?

Right
But you just need to change the command and the model ID.
Reply
#34

Quote:
Originally Posted by GTAguillaume
Quote:

I must do that for every car model right?

Right
But you just need to change the command and the model ID.
K thanks!

Edit:

I hope that i dont bother you, but now i need a command that locks only 3 o 4 admins cars, is that possible?

Thanks again!
Reply
#35

Hey, i need script where you can just press Enter on the keyboard to enter a house/Biz...
Reply
#36

Quote:
Originally Posted by Fedee!
Quote:
Originally Posted by GTAguillaume
Quote:

I must do that for every car model right?

Right
But you just need to change the command and the model ID.
K thanks!

Edit:

I hope that i dont bother you, but now i need a command that locks only 3 o 4 admins cars, is that possible?

Thanks again!
On the top of your script:
Код:
new admincars[4],bool:lockveh[4]; //lets make 4 admin cars ;)
OnGameModeInit:
Код:
admincars[0] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[1] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[2] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[3] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
Код:
if (!strcmp("/lockadminvehicles", cmd, true))
{
if(lockveh == true) return SendClientMessage(playerid,0xff0000AA,"The cars are already locked!");
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
for(new j;j<sizeof(admincars);j++) SetVehicleParamsForPlayer(admincars[j],playerid,0,1);
}
}
lockveh = true;
return 1;
}
Код:
if (!strcmp("/unlockadminvehicles", cmd, true))
{
if(lockveh == false) return SendClientMessage(playerid,0xff0000AA,"The cars are not locked!");
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
for(new j;j<sizeof(admincars);j++) SetVehicleParamsForPlayer(admincars[j],playerid,0,0);
}
}
lockveh = false;
return 1;
}
OnVehicleStreamIn:
Код:
if(lockveh)for(new i;i<sizeof(admincars);i++)if(admincars[i] == vehicleid && !IsPlayerAdmin(playerid)) SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
EDIT: oops, i forgot the command, wait a second.
EDIT2: Done
EDIT3: bugs fixed
Reply
#37

Quote:
Originally Posted by manunited1878
Hey, i need script where you can just press Enter on the keyboard to enter a house/Biz...
Top of your script:
Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
OnPlayerKeyStateChange:
Код:
if(PRESSED(KEY_SECONDARY_ATTACK)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,X,Y,Z)) //change X,Y,Z
{
SetPlayerPos(playerid,X,Y,Z); //change X,Y,Z
SetPlayerInterior(playerid,INTERIOR); //change interior
}
}
Reply
#38

Quote:
Originally Posted by GTAguillaume
Quote:
Originally Posted by Fedee!
Quote:
Originally Posted by GTAguillaume
Quote:

I must do that for every car model right?

Right
But you just need to change the command and the model ID.
K thanks!

Edit:

I hope that i dont bother you, but now i need a command that locks only 3 o 4 admins cars, is that possible?

Thanks again!
On the top of your script:
Код:
new admincars[4],bool:lockveh; //lets make 4 admin cars ;)
OnGameModeInit:
Код:
admincars[0] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[1] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[2] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[3] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
Код:
if (!strcmp("/lockadminvehicles", cmd, true))
{
if(lockveh == true) return SendClientMessage(playerid,0xff0000AA,"The cars are already locked!");
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
for(new j;j<sizeof(admincars);j++) SetVehicleParamsForPlayer(admincars[j],playerid,0,1);
}
}
lockveh = true;
return 1;
}
Код:
if (!strcmp("/unlockadminvehicles", cmd, true))
{
if(lockveh == false) return SendClientMessage(playerid,0xff0000AA,"The cars are not locked!");
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
for(new j;j<sizeof(admincars);j++) SetVehicleParamsForPlayer(admincars[j],playerid,0,0);
}
}
lockveh = false;
return 1;
}
OnVehicleStreamIn:
Код:
if(lockveh)for(new i;i<sizeof(admincars);i++)if(admincars[i] == vehicleid && !IsPlayerAdmin(playerid)) SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
EDIT: oops, i forgot the command, wait a second.
EDIT2: Done
EDIT3: bugs fixed
Sorry again But i need 1 for each i getting u crazy XD

Thanks!
Reply
#39

(You need strtok for it)

On the top of your script:
Код:
new admincars[4],bool:lockveh[4]; //lets make 4 admin cars ;)
OnGameModeInit:
Код:
admincars[0] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[1] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[2] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[3] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
Код:
if (!strcmp("/lockadminvehicle", cmd, true))
{
tmp = strtok(cmdtext,idx);
new ID = strval(tmp)-1;
if(ID < 0 || ID > sizeof(admincars)) return SendClientMessage(playerid,0xff0000AA,"Invalid ID!");
if(lockveh[ID] == true) return SendClientMessage(playerid,0xff0000AA,"The car is already locked!");
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(admincars[ID],i,0,1);
}
}
lockveh[ID] = true;
return 1;
}
Код:
if (!strcmp("/unlockadminvehicles", cmd, true))
{
tmp = strtok(cmdtext,idx);
new ID = strval(tmp)-1;
if(ID < 0 || ID > sizeof(admincars)) return SendClientMessage(playerid,0xff0000AA,"Invalid ID!");
if(lockveh[ID] == false) return SendClientMessage(playerid,0xff0000AA,"The car is not locked!");
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(admincars[ID],i,0,0);
}
}
lockveh[ID] = false;
return 1;
}
OnVehicleStreamIn:
Код:
for(new i;i<sizeof(admincars);i++)if(admincars[i] == vehicleid && !IsPlayerAdmin(playerid) && lockveh[ID]) SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
bugs are possible, post or PM me if you found one.

Usage: /lockadmincar ID (1-4) and /unlockadmincar ID (1-4)
Reply
#40

Quote:
Originally Posted by GTAguillaume
(You need strtok for it)

On the top of your script:
Код:
new admincars[4],bool:lockveh[4]; //lets make 4 admin cars ;)
OnGameModeInit:
Код:
admincars[0] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[1] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[2] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
admincars[3] = CreateVehicle(MODEL,X,Y,Z,ROT,COLOR1,COLOR2,RESPAWN_DELAY); //change MODEL, X,Y,Z,ROT,COLOR1, COLOR2 and respawn_delay
Код:
if (!strcmp("/lockadminvehicle", cmd, true))
{
tmp = strtok(cmdtext,idx);
new ID = strval(tmp)-1;
if(ID < 0 || ID > sizeof(admincars)) return SendClientMessage(playerid,0xff0000AA,"Invalid ID!");
if(lockveh[ID] == true) return SendClientMessage(playerid,0xff0000AA,"The car is already locked!");
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(admincars[ID],i,0,1);
}
}
lockveh[ID] = true;
return 1;
}
Код:
if (!strcmp("/unlockadminvehicles", cmd, true))
{
tmp = strtok(cmdtext,idx);
new ID = strval(tmp)-1;
if(ID < 0 || ID > sizeof(admincars)) return SendClientMessage(playerid,0xff0000AA,"Invalid ID!");
if(lockveh[ID] == false) return SendClientMessage(playerid,0xff0000AA,"The car is not locked!");
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(admincars[ID],i,0,0);
}
}
lockveh[ID] = false;
return 1;
}
OnVehicleStreamIn:
Код:
for(new i;i<sizeof(admincars);i++)if(admincars[i] == vehicleid && !IsPlayerAdmin(playerid) && lockveh[ID]) SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
bugs are possible, post or PM me if you found one.

Usage: /lockadmincar ID (1-4) and /unlockadmincar ID (1-4)
K!! Ill try it tomorrow!! Thanks!!!!!
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)