SA-MP Forums Archive
Cases - 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)
+--- Thread: Cases (/showthread.php?tid=663587)



Cases - Thanks - 05.02.2019

What the problem here??

Errors #Case:

Код:
: error 014: invalid statement; not in switch
warning 215: expression has no effect
error 001: expected token: ";", but found ":"
error 029: invalid expression, assumed zero
PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponid)
{
    if(
issuerid != INVALID_PLAYER_ID/// If not self-inflicted
    
{
        if(
gTeam[issuerid] != PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid))) // If we wasn't in the team of the guys who damage him.
        
{
            case 
0:
            {
                
SetPlayerWantedLevel(issueridGetPlayerWantedLevel(issuerid) + 4);
                
SetPlayerColor(issueridCOLOR_ORANGE);
                
SendClientMessage(issueridCOLOR_ORANGE"{FF8300}[WANTED LEVEL INCREASED]: YOU PUSHING A POLICE MAN AND YOUR WANTED LEVEL ARE INCREASED +4.");
                
GameTextForPlayer(issuerid"~R~RUN~G~RUN~P~RUN"50005);
                
SendClientMessage(issuerid, -1"{FF0000}NOTE: {FFFFFF}If you think it was a abuse pushing by the Police Please {FF0000}/complain(/c) {FFFFFF}him.");
                
PushingPoliceMan[issuerid] = SetTimerEx("ResetPushingPoliceMan"300000"i"issuerid);
                
PushingPoliceMan[issuerid] = -1;
                
PlayerPlaySound(issuerid158670.0,0.0,5.0);
                
format(fstr2sizeof(fstr2), "{FF8300}[INCREASED]: {FFFFFF}Player {0080FF}%s(%d) {FFFFFF}his wanted level are {FF8300}INCREASED {FFFFFF}because he pushing/shooting you!!!",TargetName(issuerid), issuerid);
                
SendClientMessage(playerid, -1fstr2);
                
PlayerPlaySound(playerid96390.0,0.0,5.0);
                
format(fstrsizeof(fstr), "[WANTED INCREASED]: Player %s(%d) his wanted level are increased because he Pushing / Shooting %s(%d)."TargetName(issuerid), issueridGetName(playerid), playerid);
                
CopRadio(COLOR_DODGERBLUEfstr);
                return 
1;
            }
            case 
1:
            {
                new 
Float:HP;
                if(
PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid)))
                
GetPlayerHealth(playeridHP);
                
PlayerPlaySound(playerid108050.0,0.0,5.0);
                
SetPlayerHealth(playeridHP-0); // Get the weapon wich he got damaged and set the damage to 0.
                
PlayerPlaySound(issuerid70470.0,0.0,5.0);
                return 
1;
            }
            case 
2:
            {
                new 
Float:HP;
                if(
FireFighter(GetPlayerSkin(issuerid)) != PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid)))
                
GetPlayerHealth(playeridHP);
                
PlayerPlaySound(playerid108050.0,0.0,5.0);
                
SetPlayerHealth(playeridHP-0); // Get the weapon wich he got damaged and set the damage to 0.
                
PlayerPlaySound(issuerid70470.0,0.0,5.0);
                return 
1;
            }
        }
    }
    return 
1;




Re: Cases - RedRex - 05.02.2019

Hey Sir!

PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponid)
{
    if(
issuerid != INVALID_PLAYER_ID/// If not self-inflicted
    
{
        if(
gTeam[issuerid] != PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid))) // If we wasn't in the team of the guys who damage him.
        
{
            switch(
issuerid)
            {
                case 
0:
                {
                    
SetPlayerWantedLevel(issueridGetPlayerWantedLevel(issuerid) + 4);
                    
SetPlayerColor(issueridCOLOR_ORANGE);
                    
SendClientMessage(issueridCOLOR_ORANGE"{FF8300}[WANTED LEVEL INCREASED]: YOU PUSHING A POLICE MAN AND YOUR WANTED LEVEL ARE INCREASED +4.");
                    
GameTextForPlayer(issuerid"~R~RUN~G~RUN~P~RUN"50005);
                    
SendClientMessage(issuerid, -1"{FF0000}NOTE: {FFFFFF}If you think it was a abuse pushing by the Police Please {FF0000}/complain(/c) {FFFFFF}him.");
                    
PushingPoliceMan[issuerid] = SetTimerEx("ResetPushingPoliceMan"300000"i"issuerid);
                    
PushingPoliceMan[issuerid] = -1;
                    
PlayerPlaySound(issuerid158670.0,0.0,5.0);
                    
format(fstr2sizeof(fstr2), "{FF8300}[INCREASED]: {FFFFFF}Player {0080FF}%s(%d) {FFFFFF}his wanted level are {FF8300}INCREASED {FFFFFF}because he pushing/shooting you!!!",TargetName(issuerid), issuerid);
                    
SendClientMessage(playerid, -1fstr2);
                    
PlayerPlaySound(playerid96390.0,0.0,5.0);

                    
format(fstrsizeof(fstr), "[WANTED INCREASED]: Player %s(%d) his wanted level are increased because he Pushing / Shooting %s(%d)."TargetName(issuerid), issueridGetName(playerid), playerid);
                    
CopRadio(COLOR_DODGERBLUEfstr);
                    return 
1;
                }
                case 
1:
                {
                    new 
Float:HP;
                    if(
PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid)))
                    
GetPlayerHealth(playeridHP);
                    
PlayerPlaySound(playerid108050.0,0.0,5.0);
                    
SetPlayerHealth(playeridHP-0); // Get the weapon wich he got damaged and set the damage to 0.
                    
PlayerPlaySound(issuerid70470.0,0.0,5.0);
                    return 
1;
                }
                case 
2:
                {
                    new 
Float:HP;
                    if(
FireFighter(GetPlayerSkin(issuerid)) != PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid)))
                    
GetPlayerHealth(playeridHP);
                    
PlayerPlaySound(playerid108050.0,0.0,5.0);
                    
SetPlayerHealth(playeridHP-0); // Get the weapon wich he got damaged and set the damage to 0.
                    
PlayerPlaySound(issuerid70470.0,0.0,5.0);
                    return 
1;
                }
            }
        }
    }
    return 
1;

Try it.


Re: Cases - TheToretto - 06.02.2019

No. Use the switch for your variable gTeam because switching issuerid makes no sense.