22.07.2010, 18:43
Hey all, I wanna create a script that will pick a random player from the server and give the player some money..
Can anyone give me a code?
Or an example.
Can anyone give me a code?
Or an example.
SetTimer("RandMoney,300000,1); // Calls the function every 3 minutes
public RandMoney();
{
GivePlayerMoney(random(MAX_PLAYERS),3000);
}
C:\Users\(lewis)\Desktop\New Folder (11)\ExStuntage.pwn(192) : error 055: start of function body without function header
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
forward RandMoney();
//Top of script
forward RandMoney();
new Players;
public OnGameModeInit()
{
SetTimer("RandMoney,300000,1);
return 1;
}
public OnPlayerConnect(playerid)
{
Players++; //Adds one player to the variable every time a player joins
return 1;
}
public OnPlayerDisconnect(playerid)
{
Players--; //Exactly the same as above but the opposite way.
return 1;
}
public RandMoney()
{
GivePlayerMoney(random(Players),3000);
}
forward RandMoney();
SetTimer("RandMoney", 30000, 1);
public RandMoney()
{
new PCount;
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i)) PCount++;
}
GivePlayerMoney(random(PCount), 3000);
}
pawn Код:
|