Set Player Score.
#1

Hey I got to help me and he made this code

forward gc(playerid); //forward....
SetTimer("gc",60000,true); // 60 seconds or??
pawn Код:
public gc(playerid)
{
    for(new i; i > MAX_PLAYERS; i++)
    {
        if(hasspawned[i] == 1)
        {
            SetPlayerScore(i, GetPlayerScore(i) + 1);
            SendClientMessage(playerid,0xFFFFFFFF,"You recieved +1 score for flying!");
        }
    }
    return 1;
}
Now, I want to change all of it only when player is in plane.
Any suggestions on how to do it?
Reply
#2

60000 is 60seconds.
pawn Код:
public gc(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(hasspawned[i] == 1)
        {
            SetPlayerScore(i, GetPlayerScore(i) + 1);
            SendClientMessage(playerid,0xFFFFFFFF,"You recieved +1 score for flying!");
        }
    }
    return 1;
}
You had the for(new part messed up.
Reply
#3

thank you! lol
now I want to do one point only for flying only planes and hilis. how would I do that?
Reply
#4

you would have to know all plane models which is a big ass list lol
Reply
#5

Quote:
Originally Posted by stix
Посмотреть сообщение
you would have to know all plane models which is a big ass list lol
I know all of them.
Because I have a pilots server xD
Reply
#6

ok then do this

if(GetPlayerVehicleID(playerid) == plane1 || GetPlayerVehicle(playerid) == 2 and go on
Reply
#7

Quote:
Originally Posted by stix
Посмотреть сообщение
ok then do this

if(GetPlayerVehicleID(playerid) == plane1 || GetPlayerVehicle(playerid) == 2 and go on
thank you ill see if it works i have to put it inside the score point right?
edit didnt add vehs only yet but I am getting errors already
Код:
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(1896) : warning 217: loose indentation
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13322) : error 017: undefined symbol "hasspawned"
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13322) : warning 215: expression has no effect
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13322) : error 001: expected token: ";", but found "]"
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13322) : error 029: invalid expression, assumed zero
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\[SFP]Server For Pilots\gamemodes\sfp.pwn(13322) : fatal error 107: too many error messages on one line

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


4 Errors.
lines:
Код:
public gc(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(hasspawned[i] == 1)
        {
            SetPlayerScore(i, GetPlayerScore(i) + 1);
            SendClientMessage(playerid,0xFFFFFFFF,"You recieved +1 score for flying!");
        }
    }
    return 1;
}
Reply
#8

new hasspawned[MAX_PLAYERS];
if(hasspawned[i])
Reply
#9

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
new hasspawned[MAX_PLAYERS];
if(hasspawned[i])
worked thx!
about this
f(GetPlayerVehicleID(playerid) == plane1 || GetPlayerVehicle(playerid) == 2
it shouldn't be like that right?
something like tihs maybe?
f(GetPlayerVehicleID(playerid) == plane1 || GetPlayerVehicle(playerid) == 2);
Reply
#10

hasspawned is useless if you're only adding points for flying (If the player is flying than of course he has spawned)


pawn Код:
public gc(playerid)
{
    new vehmod;
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER)continue; //if player isn't driving, don't count it
        vehmod=GetVehicleModel(GetPlayerVehicleID(playerid));
        if((vehmod==592)||(vehmod==577)) //Continue this pattern for 511,512,593,520,553,476,519,460,513,548,425,417,487,488,497,563,447,469
        {
            SetPlayerScore(i, GetPlayerScore(i) + 1);
            SendClientMessage(playerid,0xFFFFFFFF,"You recieved +1 score for flying!");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)