Little Help please :-]
#1

This is from 90NINE's World Cup mode:

PAWN Code:

pawn Код:
// [NB]90NINE's World Cup GM

#include <a_samp>

#define MAX_SLOTS 13

new LifeUpdateVar[MAX_PLAYERS];
new Float:LifeUpdateAmt[MAX_PLAYERS];
new Current = -1;
new HighestID;
new NickName[MAX_PLAYERS+1];

new Text:pText[MAX_PLAYERS];
new Text:pText1[MAX_PLAYERS];

public OnGameModeInit()
{
    CreateGlobalTextdraws();
    SetTimer("UpdateVehicleStatus",1000,1);
    SetTimer("LifeUpdater",1000,1);
    return 1;
}

forward CreateGlobalTextdraws();
CreateGlobalTextdraws()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
    {
        pText1[i] = TextDrawCreate(150.0, 370.0,"vehicle info");
        TextDrawFont(pText1[i],1);
        TextDrawLetterSize(pText1[i],0.2,0.7);
        TextDrawColor(pText1[i],0xFFFFFFFF);
        TextDrawSetShadow(pText1[i],1);
        TextDrawSetOutline(pText1[i],1);
        TextDrawBackgroundColor(pText1[i],0x000000FF);
   
        pText[i] = TextDrawCreate(525.0, 390.0,"Life: ");
        TextDrawAlignment(pText[i],0);
        TextDrawFont(pText[i],3);
        TextDrawLetterSize(pText[i],0.50,1.50);
        TextDrawSetOutline(pText[i],1);
        TextDrawSetShadow(pText[i],1);
        TextDrawBackgroundColor(pText[i],0x000000FF);
        TextDrawSetProportional(pText[i],1);
        TextDrawColor(pText[i], 0xFF804044);
    }
    return 1;
}

forward OnPlayerHealthChange(playerid,Float:oldhealth,Float:newhealth);
public OnPlayerHealthChange(playerid,Float:oldhealth,Float:newhealth)
{
    new string[256];
    if(LifeUpdateVar[playerid] > 0)LifeUpdateAmt[playerid]+=(oldhealth - newhealth);
    else LifeUpdateAmt[playerid] = oldhealth - newhealth;
   
    LifeUpdateVar[playerid] = 3;
    format(string,20,"%.0f DMG",LifeUpdateAmt[playerid]);
    TextDrawSetString(pText[playerid],string);
    return 1;
}

forward OnPlayerArmourChange(playerid,Float:oldarmour,Float:newarmour);
public OnPlayerArmourChange(playerid,Float:oldarmour,Float:newarmour)
{
    new string[256];
    if(LifeUpdateVar[playerid] > 0)LifeUpdateAmt[playerid]+=(oldarmour - newarmour);
    else LifeUpdateAmt[playerid] = oldarmour - newarmour;

    LifeUpdateVar[playerid] = 3;
    format(string,20,"%.0f DMG",LifeUpdateAmt[playerid]);
    TextDrawSetString(pText[playerid],string);
    return 1;
}

forward LifeUpdater();
public LifeUpdater()
{
    if(Current == -1)return 1;
    for(new i; i < HighestID+1; i++)
    {
      if(LifeUpdateVar[i] > 0)
      {
        LifeUpdateVar[i]--;
      }
      if(LifeUpdateVar[i] == 0)
      {
        TextDrawSetString(pText[i]," ");
      }
    }
    return 1;
}

forward UpdateVehicleStatus();
public UpdateVehicleStatus()
{
    new bool:occu[MAX_VEHICLES];
    for(new i = 0; i < 200; i++)
    {
      if(occu[i] == true)
      {
        UpdateVehicleOccupants(i);
      }
    }
}

UpdateVehicleOccupants(vehicleid)
{
    new string[256],pGuns[4][60],bool:used[4],nameid[4];
    for(new i = 0; i < 4; i++)
    {
        nameid[i] = MAX_PLAYERS;
    }
  for(new i = 0; i < HighestID+1; i++)
    {
      if(IsPlayerInVehicle(i,vehicleid))
      {
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
          nameid[0] = i;
        }
        else
        {
          if(used[1] == false)
          {
            nameid[1] = i;
            used[1] = true;
          }
          else if(used[2] == false)
          {
            nameid[2] = i;
            used[2] = true;
          }
          else if(used[3] == false)
          {
            nameid[3] = i;
            used[3] = true;
          }
        }
      }
    }
    format(string,256,"~r~- ~w~%s ~r~%s ~n~~r~- ~w~%s ~r~%s ~n~~r~- ~w~%s ~r~%s ~n~~r~- ~w~%s ~r~%s",NickName[nameid[0]],pGuns[0],NickName[nameid[1]],pGuns[1],NickName[nameid[2]],pGuns[2],NickName[nameid[3]],pGuns[3]);
    for(new i = 0; i < HighestID+1; i++)
    {
      if(IsPlayerInVehicle(i,vehicleid))
      {
        TextDrawHideForPlayer(i,pText1[i]);
        TextDrawSetString(pText1[i],string);
        TextDrawShowForPlayer(i,pText1[i]);
      }
    }
}
No compile errors, but don't work ingame.
Help me plz :P



btw, Sorry Kaisermouse, but the World Cup's topic has been deleted for some reason :S
Reply


Messages In This Thread
Little Help please :-] - by PlayMaker - 07.07.2009, 22:03
Re: Little Help please :-] - by Correlli - 07.07.2009, 22:05
Re: Little Help please :-] - by PlayMaker - 07.07.2009, 22:07
Re: Little Help please :-] - by PlayMaker - 08.07.2009, 10:49
Re: Little Help please :-] - by PlayMaker - 08.07.2009, 22:18
Re: Little Help please :-] - by Weirdosport - 08.07.2009, 22:23

Forum Jump:


Users browsing this thread: 2 Guest(s)