Derby Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Derby Help (
/showthread.php?tid=129418)
Derby Help -
Jason321 - 22.02.2010
Hey guys,
I'm working on a derby script at the moment and everything is going alright up until now. I've made it so that it puts you in any available car, if none are available you are unable to join. The problem is that it seems if you /derbyjoin the cars just double up. So for every player the cars just re-add themselves. If anybody could help me with this, that would be good.
http://pastebin.com/fabf859e
Thanks
Re: Derby Help -
Onyx09 - 22.02.2010
you are using playerid wich will be for the player command so there will be 9 diff chances to join maybe
if you use (i) Max_Players instad of playerid that will be like a global check so pretty much your script right now
gives one player 9 diff choices to join lol
dont flame me if im wrong i took a fast look at the script its 12 am here time to go work tomorow i hope this helps
good luck
Re: Derby Help -
Jason321 - 22.02.2010
Thanks for replying, I appreciate it. But I don't understand where I am supposed to use:
Re: Derby Help -
Onyx09 - 22.02.2010
alll over /derbyjoin command
playerid reffers to the player whos using the command so he will have 9 cases (cars) to join of course it wont be copied like u said
ur just givin each player 10 options to join lol
so replace the playerid's there for i wich its max_players so this will count for everyplayer maybe this fix your problem
Re: Derby Help -
Jason321 - 22.02.2010
Sorry but you confused me more there :P I'm supposed to replace every [playerid] with [max_players]?
Re: Derby Help -
Onyx09 - 22.02.2010
no i give you an example hold on
Re: Derby Help -
Onyx09 - 22.02.2010
Код:
if (strcmp(cmdtext, "/derbyjoin", true) == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pInfo[playerid][Derby] == 0)
{
SetPlayerVirtualWorld(playerid, 999);
SetPlayerInterior(playerid, 15);
new string[256], name[24]; GetPlayerName(playerid,name,24);
format(string,256,"%s has joined the Derby. Type /derbyjoin to join them!",name);
SendClientMessageToAll(COLOR_WHITE,string);
SendClientMessage(playerid,COLOR_YELLOW,"Welcome to the Derby, please wait patiently for the derby to commence.");
if(IsVehicleOccupied(vehicle1))
{
PutPlayerInVehicle(i,vehicle2,0);
pInfo[playerid][Derby] = 1;
}
else
{
PutPlayerInVehicle(i,vehicle1,0);
pInfo[playerid][Derby] = 1;
}
try tsomething like this
Re: Derby Help -
Jason321 - 22.02.2010
Thanks but I experienced the same problem
Re: Derby Help -
Onyx09 - 22.02.2010
you need to change other player ids i gave you a hint
thats how people learn
Re: Derby Help -
Jason321 - 22.02.2010
I changed
all the
Код:
(playerid,vehiclex,0);
into
Do you mean there are others I have to do that aren't related to the vehicles?