Little Help
#1

Hello everyone.Those days I was scripting my own Capture Gangzone.But I get one strange problem.Always when player ID 1 capture turf.Always GetPlayerTeam checks only ID 0.How can I explain.Anyother ID can capture but turf always capture by team 1 better says always show team from Player ID 0.How it is possible.CODE:
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == LSDPCP)
    {
        if(UnderAttack == 1) return SendClientMessage(playerid, 0xFF0000FF,""embed_red"[ERROR] "embed_white"This zone is already being taken over!");
        {
            if(TeamCheck == GetPlayerTeam(playerid))return SendClientMessage(playerid, 0xFF0000FF,""embed_red"[ERROR] "embed_white"This zone is already captured by your team");
            {
                if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF,""embed_red"[ERROR] "embed_white"You cannot capture while in vehicle!");
                {
                    UnderAttack = 1;
                    if(UserStats[playerid][Vip] == 0)
                    {
                        Timer1 = SetTimer("SetZone",30000,0);
                    }
                    if(UserStats[playerid][Vip] == 1)
                    {
                        Timer1 = SetTimer("SetZone",15000,0);
                    }
                    GangZoneFlashForAll(LSDPZone,red);
                    SendClientMessageToAll(0xFFFFFFFF,"{00D5FF}[TURF] "embed_white"Pershing Square is begin attacked!");
                }
            }
        }
    }
    return 1;
}
forward SetZone(playerid);
public SetZone(playerid)
{
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 3); //Giving score and money
    GivePlayerMoney(playerid, 3000);
    if(sPanel[Doublexp] == 1)
    {
        SendClientMessage(playerid,0xFFFFFFF,"{00D5FF}[DOUBLE-XP - TURF]"embed_white" Congratulation! You have Gained 3 Scores & 3000$ Money & 50 XP!");
        UserStats[playerid][XP] += 100;
    }
    else
    {
        SendClientMessage(playerid,0xFFFFFFF,"{00D5FF}[TURF]"embed_white" Congratulation! You have Gained 3 Scores & 3000$ Money & 50 XP!");
        UserStats[playerid][XP] += 50;
    }
    UnderAttack = 0; //Stopping the UnderAttack
    SetGangZone(playerid); //We will define it..
    return 1;
}
forward SetGangZone(playerid);
public SetGangZone(playerid)
{
    if(GetPlayerTeam(playerid) == 1)
    {
        LSDPColor = USACOLOR;
    }
    if(GetPlayerTeam(playerid) == 2)
    {
        LSDPColor = KOREACOLOR;
    }
    GangZoneShowForAll(LSDPZone,GetPlayerColor(playerid));
    /*Following code looks a bit big but its very simple.. its just send msg. */
    new string[126], pName5[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName5,sizeof(pName5));
    format(string,sizeof string,"{00D5FF}[TURF] "embed_white"%s has captured {FFD900}Pershing Square "embed_white"!",pName5);
    GangZoneStopFlashForAll(LSDPZone);
    SendClientMessageToAll(0xFFFFFFFF, string);
    TeamCheck = pTeam[playerid];
    GangZoneShowForAll(LSDPZone,LSDPColor);
    return 1;
}
Need fast help.Thanks.
Reply
#2

Anyone can help me please?
Reply
#3

That's a pretty basic mistake, you should SetTimerEx not SetTimer
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == LSDPCP)
    {
        if(UnderAttack == 1) return SendClientMessage(playerid, 0xFF0000FF,""embed_red"[ERROR] "embed_white"This zone is already being taken over!");
        {
            if(TeamCheck == GetPlayerTeam(playerid))return SendClientMessage(playerid, 0xFF0000FF,""embed_red"[ERROR] "embed_white"This zone is already captured by your team");
            {
                if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF,""embed_red"[ERROR] "embed_white"You cannot capture while in vehicle!");
                {
                    UnderAttack = 1;
                    if(UserStats[playerid][Vip] == 0)
                    {
                    Timer1 = SetTimerEx("SetZone",30000,0,"i",playerid);
                    }
                    if(UserStats[playerid][Vip] == 1)
                    {
                        Timer1 = SetTimerEx("SetZone",15000,0,"i",playerid);
                    }
                    GangZoneFlashForAll(LSDPZone,red);
                    SendClientMessageToAll(0xFFFFFFFF,"{00D5FF}[TURF] "embed_white"Pershing Square is begin attacked!");
                }
            }
        }
    }
    return 1;
}
forward SetZone(playerid);
public SetZone(playerid)
{
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 3); //Giving score and money
    GivePlayerMoney(playerid, 3000);
    if(sPanel[Doublexp] == 1)
    {
        SendClientMessage(playerid,0xFFFFFFF,"{00D5FF}[DOUBLE-XP - TURF]"embed_white" Congratulation! You have Gained 3 Scores & 3000$ Money & 50 XP!");
        UserStats[playerid][XP] += 100;
    }
    else
    {
        SendClientMessage(playerid,0xFFFFFFF,"{00D5FF}[TURF]"embed_white" Congratulation! You have Gained 3 Scores & 3000$ Money & 50 XP!");
        UserStats[playerid][XP] += 50;
    }
    UnderAttack = 0; //Stopping the UnderAttack
    SetGangZone(playerid); //We will define it..
    return 1;
}
forward SetGangZone(playerid);
public SetGangZone(playerid)
{
    if(GetPlayerTeam(playerid) == 1)
    {
        LSDPColor = USACOLOR;
    }
    if(GetPlayerTeam(playerid) == 2)
    {
        LSDPColor = KOREACOLOR;
    }
    GangZoneShowForAll(LSDPZone,GetPlayerColor(playerid));
    /*Following code looks a bit big but its very simple.. its just send msg. */
    new string[126], pName5[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName5,sizeof(pName5));
    format(string,sizeof string,"{00D5FF}[TURF] "embed_white"%s has captured {FFD900}Pershing Square "embed_white"!",pName5);
    GangZoneStopFlashForAll(LSDPZone);
    SendClientMessageToAll(0xFFFFFFFF, string);
    TeamCheck = pTeam[playerid];
    GangZoneShowForAll(LSDPZone,LSDPColor);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)