Re: Little coding questions - For general minor queries 5 -
Backwardsman97 - 08.08.2008
How could I use something other then the TogglePlayerSpectating? What all does it do? Does it just freeze the player and make him disappear? I could do that myself. It's just because when I toggle back from spectating, it respawns me and OnPlayerSpawn is called. I don't like that. If I just set my player's position or virtual and froze me wouldn't it be the same?
Re: Little coding questions - For general minor queries 5 -
Redgie - 09.08.2008
Quote:
|
Originally Posted by backwardsman97
How could I use something other then the TogglePlayerSpectating? What all does it do? Does it just freeze the player and make him disappear? I could do that myself. It's just because when I toggle back from spectating, it respawns me and OnPlayerSpawn is called. I don't like that. If I just set my player's position or virtual and froze me wouldn't it be the same?
|
I had a similar issue, but use timers and variables to store the players weapon data and position and all will be fixed!
Re: Little coding questions - For general minor queries 5 -
Donuts - 15.08.2008
How to use SetTimerEx properly?
I need it for an anti spam of a drug script. I first use SetTimer and created a function, CrackUses, but this works for player id 0 only, so someone told me to use SetTimerEx, but i dont know how to.... : /
Re: Little coding questions - For general minor queries 5 -
Backwardsman97 - 15.08.2008
pawn Code:
SetTimerEx(funcname[], interval, repeating, const format[], {Float,_}:...)
An example for a playerid in a function would be like.
pawn Code:
SetTimerEx("SomeFunction",1000,1,"i",playerid);
The format is like this.
Code:
i Stands for an integer parameter.
d Exactly the same as i.
a Passes an array, the next parameter must be an integer ("i") with the array's size.
s Stands for a string parameter.
f Stands for a float parameter.
b Stands for a boolean parameter.
http://www.sareallife.org/sampwiki/w...etTimerEx.html
And for two parameters.
pawn Code:
SetTimerEx("Fix",2000,0,"ii",playerid,GetPlayerVehicleID(playerid);
Re: Little coding questions - For general minor queries 5 -
Redirect Left - 16.08.2008
What's the current pickup limit?
Re: Little coding questions - For general minor queries 5 -
Backwardsman97 - 16.08.2008
Quote:
|
Originally Posted by [RP
Jolteon ]
What's the current pickup limit?
|
I think it's 400.
Re: Little coding questions - For general minor queries 5 -
GTA_Rules - 06.04.2009
Hi!
This isn't a problem, I'm just wondering how I could make an infinite loop of to check wheter a player is 15 meters away from a point (using PlayerToPoint)
Re: Little coding questions - For general minor queries 5 -
Donny_k - 06.04.2009
Quote:
|
Originally Posted by GTA_Rules
Hi!
This isn't a problem, I'm just wondering how I could make an infinite loop of to check wheter a player is 15 meters away from a point (using PlayerToPoint)
|
SetTimer( ... ).
Re: Little coding questions - For general minor queries 5 -
Torekk - 06.04.2009
How to check if the player is the driver of the vehicle? I tried it with:
pawn Code:
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
}
But it doesn't works.
Re: Little coding questions - For general minor queries 5 -
GTA_Rules - 06.04.2009
Quote:
|
Originally Posted by Torekk
How to check if the player is the driver of the vehicle? I tried it with:
pawn Code:
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) { }
But it doesn't works.
|
Code:
// On top of your script:
new vehicle;
// In OnGameModeInit
vehicle = AddStaticVehicle(...)
// Outside other functions (most likely at the end of your script).
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new numero = GetPlayerVehicleID(playerid);
if(numero == vehicle)
{
// Do something here
}
}
return 1;
}
Sorry if the intendation got fucked.
Re: Little coding questions - For general minor queries 5 -
Torekk - 06.04.2009
Well, thanks for your help at first. But how would I then "include" into this command?
pawn Code:
if (strcmp("/fix", cmdtext, true)==0)
{
if((!IsPlayerInAnyVehicle(playerid)) && (GetPlayerState(playerid) != PLAYER_STATE_DRIVER))
{
SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle or you're not the driver of it!");
} else {
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
}
return 1;
}
Edit: That command works, but when you enter as a passenger, you can still repair the vehicle, so I guess that PLAYER_STATE_DRIVER is either not available or wrong.
Edit2: It appears that you can't use GetPlayerState(playerid) != PLAYER_STATE_DRIVER, you'll have to make it "vice versa".
Re: Little coding questions - For general minor queries 5 -
tom_jonez - 06.04.2009
Quote:
|
Originally Posted by Torekk
Well, thanks for your help at first. But how would I then "include" into this command?
pawn Code:
if (strcmp("/fix", cmdtext, true)==0) { if((!IsPlayerInAnyVehicle(playerid)) && (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)) { SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle or you're not the driver of it!"); } else { SetVehicleHealth(GetPlayerVehicleID(playerid), 1000); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); } return 1; }
Edit: That command works, but when you enter as a passenger, you can still repair the vehicle, so I guess that PLAYER_STATE_DRIVER is either not available or wrong.
Edit2: It appears that you can't use GetPlayerState(playerid) != PLAYER_STATE_DRIVER, you'll have to make it "vice versa".
|
remove the parentheses around the getplayerstate
Re: Little coding questions - For general minor queries 5 -
Backwardsman97 - 06.04.2009
Quote:
|
Originally Posted by Torekk
Well, thanks for your help at first. But how would I then "include" into this command?
pawn Code:
if (strcmp("/fix", cmdtext, true)==0) { if((!IsPlayerInAnyVehicle(playerid)) && (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)) { SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle or you're not the driver of it!"); } else { SetVehicleHealth(GetPlayerVehicleID(playerid), 1000); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); } return 1; }
Edit: That command works, but when you enter as a passenger, you can still repair the vehicle, so I guess that PLAYER_STATE_DRIVER is either not available or wrong.
Edit2: It appears that you can't use GetPlayerState(playerid) != PLAYER_STATE_DRIVER, you'll have to make it "vice versa".
|
Why not do like this?
pawn Code:
if (strcmp("/fix", cmdtext, true)==0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle or you're not the driver of it!");
}
return 1;
}
No need for the check for if they are in the vehicle because their state can't be driver if they aren't in a vehicle.
Re: Little coding questions - For general minor queries 5 -
miokie - 07.04.2009
Quick question:
I'm trying to make it so when a player calls a Taxi it will send a message to taxi drivers only, I've searched around abit' and all ive found are team chats taht use TEAM_GROVE for example... To identify a player as a taxi driver in my script I use
Any help appreciated, thanks.
Re: Little coding questions - For general minor queries 5 -
GTA_Rules - 07.04.2009
Maybe use gTeam then a check if the player is in the team and send him a message
Re: Little coding questions - For general minor queries 5 -
miokie - 07.04.2009
Quote:
|
Originally Posted by Matthias™
Maybe use gTeam then a check if the player is in the team and send him a message
|
I dont really like using gTeam, is there any other way?
Edit: I've worked out how to do it by looking at /Report commands
Re: Little coding questions - For general minor queries 5 -
seven - 05.05.2009
- fixed -
Re: Little coding questions - For general minor queries 5 -
seven - 06.05.2009
as i for some reason cant modify the above one
i got to make this new post
Code:
hPickup[Houseid] = CreatePickup(1273,1,x,y,z);
// xyz and Houseid are nice defined in a stock
wont let me spawn a pickup nor will they allow text when i
do on player pickup i tried a couple of streamers
but how can i make it that a id in a pickup id would be useable
edit fixed aswell
Code:
god = CreatePickup(1273,1,x,y,z);;
hPickup = god
Re: Little coding questions - For general minor queries 5 -
BioFreeze - 09.05.2009
It is possible to refer to a command in a function , without re-typing the code that's used to make the command work ? For example if you created a menu and you want to execute the command ''/help'' if he has chosen " case 0 ". Etc etc.
Re: Little coding questions - For general minor queries 5 -
pspleo - 09.05.2009
Quote:
|
Originally Posted by Biofreeze
It is possible to refer to a command in a function , without re-typing the code that's used to make the command work ? For example if you created a menu and you want to execute the command ''/help'' if he has chosen " case 0 ". Etc etc.
|
OnPlayerCommand(playerid, "/help");
Leopard