SA-MP Forums Archive
If you script well, little 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: If you script well, little help (/showthread.php?tid=84473)



If you script well, little help - lilstuh - 01.07.2009

Hey guys. I was trying to put a few codes into my gamemode but they keep giving errors. and i cant fix these stupid errors... can someone successfully put in these codes into the gamemode.... plz thanks

my gamemode==== http://pastebin.com/d29abc786


the codes:
1)anti team kill code


//ANTI TEAMKILL
public OnGameModeInit()
{
SetTimer("UpdateTeams", 1000, 1);
return 1;
}

forward UpdateTeams();
public UpdateTeams()
{
for(new i = 0; i<GetMaxPlayers(); i++)
{
if(gTeam[i] == 1) { SetPlayerTeam(playerid, 1); }
else if(gTeam[i] == 2) { SetPlayerTeam(playerid, 2); }
}
}

__________________________________________________ ___________________________


2) when person logs on/ logs off u get his ip
https://sampwiki.blast.hk/wiki/GetPlayerIp This...


or

// top of your gamemode
forward SettingPlayerTeam();
//OnPlayerConnect
SetTimerEx("SettingPlayerTeam",10,1,"d",playerid);
//Bottom of your script
public SettingPlayerTeam()
{
for(new playerid; playerid < 200; playerid++)
SetPlayerTeam(playerid, gTeam[playerid]);
return 1;
}





if anyone could help i would be greatly appriciated.. thanks ppl





Re: If you script well, little help - Abernethy - 01.07.2009

Post your errors.

EDIT: Use
Код:
pawn Код:
CODE HERE



Re: If you script well, little help - Grim_ - 01.07.2009

He doesn't have errors he just wants people to put it into his gm


Re: If you script well, little help - Abernethy - 01.07.2009

Quote:
Originally Posted by lilstuh
Hey guys. I was trying to put a few codes into my gamemode but they keep giving errors. and i cant fix these stupid errors... can
I believe not?
He needs to learn to script himself though ..


Re: If you script well, little help - Grim_ - 01.07.2009

I know, him he told me that's what he wanted, but I'm too lazy to post the correct code.


Re: If you script well, little help - ByFukara - 01.07.2009

post your errors


Re: If you script well, little help - Andom - 01.07.2009

Well, you are flooding your server?
Код:
SetTimerEx("SettingPlayerTeam",10,1,"d",playerid);

public SettingPlayerTeam()
{
  for(new playerid; playerid < 200; playerid++)
    SetPlayerTeam(playerid, gTeam[playerid]);
  return 1;
}
Did you know you are executing something 200 times every 0.001 seconds?


Re: If you script well, little help - Grim_ - 01.07.2009

You do that because the SetPlayerTeam function is not always synced. So setting their team every X amount of seconds will make it perfectly sycned.


Re: If you script well, little help - lilstuh - 01.07.2009

C:\Documents and Settings\\Desktop\SHIP\gamemodes\freighter.pwn(107 ) : error 010: invalid function or declaration
C:\Documents and Settings\Desktop\SHIP\gamemodes\freighter.pwn(111) : error 001: expected token: "-identifier-", but found ";"
C:\Documents and Settings\\Desktop\SHIP\gamemodes\freighter.pwn(112 ) : error 036: empty statement
C:\Documents and Settings\\Desktop\SHIP\gamemodes\freighter.pwn(221 ) : error 029: invalid expression, assumed zero
C:\Documents and Settings\\Desktop\SHIP\gamemodes\freighter.pwn(221 ) : warning 215: expression has no effect
C:\Documents and Settings\\Desktop\SHIP\gamemodes\freighter.pwn(221 ) : error 001: expected token: ";", but found ")"
C:\Documents and Settings\\Desktop\SHIP\gamemodes\freighter.pwn(221 ) : error 029: invalid expression, assumed zero
C:\Documents and Settings\\Desktop\SHIP\gamemodes\freighter.pwn(221 ) : fatal error 107: too many error messages on one line

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


Re: If you script well, little help - Flo_White - 01.07.2009

why do you use a Timer for the Anti Teamkill.
You can use OnPlayerDeath