SA-MP Forums Archive
Scripting help - 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: Scripting help (/showthread.php?tid=349477)



Scripting help - Johnny_Robins - 09.06.2012

Alright i ran into an a problem

How could I get this to work with CMDetplate for admin level 4

Код:
	if(PlayerInfo[playerid][pAdmin] >= 4) {
Код:
CMD:setplate( playerid, params[] )
{
        new iVictim, szPlate[32];
        if( sscanf( params, "us[32]", iVictim, szPlate ) )
            return SendClientMessage( playerid, -1, "Syntax: /plate [playerid][plate(1-32 letters)]" );
 
        if( strlen( szPlate ) > 32 )
            return SendClientMessage( playerid, -1, "Syntax: /plate [playerid][plate(1-32 letters)]" );
 
        if( !IsPlayerAdmin( playerid ) )
            return SendClientMessage( playerid, -1, "Error: You're not an administrator." );
 
        if( !IsPlayerConnected( iVictim ) )
            return SendClientMessage( playerid, -1, "Error: That player isn't connected." );
 
        if( !IsPlayerInAnyVehicle( iVictim ) )
            return SendClientMessage( playerid, -1, "Error: That player isn't in a vehicle." );
 
        new szString[128], pVeh, Float:vPos[4];
        pVeh = GetPlayerVehicleID( iVictim );
 
        format( v_Plate[pVeh], 32, "%s", szPlate );
        SetVehicleNumberPlate( pVeh, szPlate );
 
        GetPlayerPos( iVictim, vPos[0], vPos[1], vPos[2] );
        GetVehicleZAngle( pVeh, vPos[3] );
        SetVehicleToRespawn( pVeh );
        SetVehiclePos( pVeh, vPos[0], vPos[1], vPos[2] );
        SetVehicleZAngle( pVeh, vPos[3] );
        PutPlayerInVehicle( iVictim, pVeh, 0 );
 
        format( szString, 128, "An administrator set your vehicle plate to %s.", szPlate );
        SendClientMessage( playerid, -1, szString );
 
        return 1;
}



Re: Scripting help - TheLazySloth - 09.06.2012

CMDetplate( playerid, params[] )
{
new iVictim, szPlate[32];
if( sscanf( params, "us[32]", iVictim, szPlate ) )
return SendClientMessage( playerid, -1, "Syntax: /plate [playerid][plate(1-32 letters)]" );

if( strlen( szPlate ) > 32 )
return SendClientMessage( playerid, -1, "Syntax: /plate [playerid][plate(1-32 letters)]" );

if( !IsPlayerAdmin( playerid ) )
return SendClientMessage( playerid, -1, "Error: You're not an administrator." );

if(PlayerInfo[playerid][pAdmin] < 4)
return SendClientMessage( playerid, -1, "Error: You're not the correct ranked administrator." );

if( !IsPlayerConnected( iVictim ) )
return SendClientMessage( playerid, -1, "Error: That player isn't connected." );

if( !IsPlayerInAnyVehicle( iVictim ) )
return SendClientMessage( playerid, -1, "Error: That player isn't in a vehicle." );

new szString[128], pVeh, Float:vPos[4];
pVeh = GetPlayerVehicleID( iVictim );

format( v_Plate[pVeh], 32, "%s", szPlate );
SetVehicleNumberPlate( pVeh, szPlate );

GetPlayerPos( iVictim, vPos[0], vPos[1], vPos[2] );
GetVehicleZAngle( pVeh, vPos[3] );
SetVehicleToRespawn( pVeh );
SetVehiclePos( pVeh, vPos[0], vPos[1], vPos[2] );
SetVehicleZAngle( pVeh, vPos[3] );
PutPlayerInVehicle( iVictim, pVeh, 0 );

format( szString, 128, "An administrator set your vehicle plate to %s.", szPlate );
SendClientMessage( playerid, -1, szString );

return 1;
}


Re: Scripting help - Djole1337 - 09.06.2012

Код:
CMD:setplate(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 4)
        {
        if( !IsPlayerInAnyVehicle( iVictim ) )
            return SendClientMessage( playerid, -1, "Error: That player isn't in a vehicle." );
 
        new szString[128], pVeh, Float:vPos[4];
        pVeh = GetPlayerVehicleID( iVictim );
 
        format( v_Plate[pVeh], 32, "%s", szPlate );
        SetVehicleNumberPlate( pVeh, szPlate );
 
        GetPlayerPos( iVictim, vPos[0], vPos[1], vPos[2] );
        GetVehicleZAngle( pVeh, vPos[3] );
        SetVehicleToRespawn( pVeh );
        SetVehiclePos( pVeh, vPos[0], vPos[1], vPos[2] );
        SetVehicleZAngle( pVeh, vPos[3] );
        PutPlayerInVehicle( iVictim, pVeh, 0 );
 
        format( szString, 128, "An administrator set your vehicle plate to %s.", szPlate );
        SendClientMessage( playerid, -1, szString );
 
        return 1;
            }
        else return SendClientMessage(playerid, COLOR_RED, "Error: You are not an admin" );
    }
    else return SendClientMessage(playerid, COLOR_RED, "Error: That player isn't connected." );
}



Re: Scripting help - Johnny_Robins - 09.06.2012

Quote:
Originally Posted by Mr_DjolE
Посмотреть сообщение
Код:
CMD:setplate(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 4)
        {
        if( !IsPlayerInAnyVehicle( iVictim ) )
            return SendClientMessage( playerid, -1, "Error: That player isn't in a vehicle." );
 
        new szString[128], pVeh, Float:vPos[4];
        pVeh = GetPlayerVehicleID( iVictim );
 
        format( v_Plate[pVeh], 32, "%s", szPlate );
        SetVehicleNumberPlate( pVeh, szPlate );
 
        GetPlayerPos( iVictim, vPos[0], vPos[1], vPos[2] );
        GetVehicleZAngle( pVeh, vPos[3] );
        SetVehicleToRespawn( pVeh );
        SetVehiclePos( pVeh, vPos[0], vPos[1], vPos[2] );
        SetVehicleZAngle( pVeh, vPos[3] );
        PutPlayerInVehicle( iVictim, pVeh, 0 );
 
        format( szString, 128, "An administrator set your vehicle plate to %s.", szPlate );
        SendClientMessage( playerid, -1, szString );
 
        return 1;
            }
        else return SendClientMessage(playerid, COLOR_RED, "Error: You are not an admin" );
    }
    else return SendClientMessage(playerid, COLOR_RED, "Error: That player isn't connected." );
}
I got these errors,

Код:
C:\Users\****\Desktop\****\****\gamemodes\FSRP.pwn(42089) : error 017: undefined symbol "iVictim"
C:\Users\****\Desktop\****\****\gamemodes\gamemodes\FSRP.pwn(42093) : error 017: undefined symbol "iVictim"
C:\Users\****\Desktop\****\****\gamemodes\gamemodes\FSRP.pwn(42095) : error 017: undefined symbol "szPlate"
C:\Users\****\Desktop\****\****\gamemodes\FSRP.pwn(42096) : error 017: undefined symbol "szPlate"
C:\Users\****\Desktop\****\****\gamemodes\gamemodes\FSRP.pwn(42098) : error 017: undefined symbol "iVictim"
C:\Users\****\Desktop\****\****\gamemodes\FSRP.pwn(42103) : error 017: undefined symbol "iVictim"
C:\Users\****\Desktop\****\****\gamemodes\FSRP.pwn(42105) : error 017: undefined symbol "szPlate"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Errors.



AW: Scripting help - JhnzRep - 09.06.2012

pawn Код:
CMD:setplate( playerid, params[] )
{
        if(PlayerInfo[playerid][pAdmin] < 4) return SCM(playerid, -1, "You're not an level 4 admin!"); // If player is below level 4 he will get this message, and command won't work.
        new iVictim, szPlate[32];
        if( sscanf( params, "us[32]", iVictim, szPlate ) )
            return SendClientMessage( playerid, -1, "Syntax: /plate [playerid][plate(1-32 letters)]" );
 
        if( strlen( szPlate ) > 32 )
            return SendClientMessage( playerid, -1, "Syntax: /plate [playerid][plate(1-32 letters)]" );
 
        if( !IsPlayerAdmin( playerid ) )
            return SendClientMessage( playerid, -1, "Error: You're not an administrator." );
 
        if( !IsPlayerConnected( iVictim ) )
            return SendClientMessage( playerid, -1, "Error: That player isn't connected." );
 
        if( !IsPlayerInAnyVehicle( iVictim ) )
            return SendClientMessage( playerid, -1, "Error: That player isn't in a vehicle." );
 
        new szString[128], pVeh, Float:vPos[4];
        pVeh = GetPlayerVehicleID( iVictim );
 
        format( v_Plate[pVeh], 32, "%s", szPlate );
        SetVehicleNumberPlate( pVeh, szPlate );
 
        GetPlayerPos( iVictim, vPos[0], vPos[1], vPos[2] );
        GetVehicleZAngle( pVeh, vPos[3] );
        SetVehicleToRespawn( pVeh );
        SetVehiclePos( pVeh, vPos[0], vPos[1], vPos[2] );
        SetVehicleZAngle( pVeh, vPos[3] );
        PutPlayerInVehicle( iVictim, pVeh, 0 );
 
        format( szString, 128, "An administrator set your vehicle plate to %s.", szPlate );
        SendClientMessage( playerid, -1, szString );
 
        return 1;
}
Try this.


Re: Scripting help - Faisal_khan - 09.06.2012

I added this :
pawn Код:
new iVictim, szPlate[32];
Your final code:
pawn Код:
CMD:setplate(playerid, params[])
{
    new iVictim, szPlate[32];
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 4)
        {
        if( !IsPlayerInAnyVehicle( iVictim ) )
            return SendClientMessage( playerid, -1, "Error: That player isn't in a vehicle." );
 
        new szString[128], pVeh, Float:vPos[4];
        pVeh = GetPlayerVehicleID( iVictim );
 
        format( v_Plate[pVeh], 32, "%s", szPlate );
        SetVehicleNumberPlate( pVeh, szPlate );
 
        GetPlayerPos( iVictim, vPos[0], vPos[1], vPos[2] );
        GetVehicleZAngle( pVeh, vPos[3] );
        SetVehicleToRespawn( pVeh );
        SetVehiclePos( pVeh, vPos[0], vPos[1], vPos[2] );
        SetVehicleZAngle( pVeh, vPos[3] );
        PutPlayerInVehicle( iVictim, pVeh, 0 );
 
        format( szString, 128, "An administrator set your vehicle plate to %s.", szPlate );
        SendClientMessage( playerid, -1, szString );
 
        return 1;
            }
        else return SendClientMessage(playerid, COLOR_RED, "Error: You are not an admin" );
    }
    else return SendClientMessage(playerid, COLOR_RED, "Error: That player isn't connected." );
}



Re: Scripting help - MarinacMrcina - 09.06.2012

Use this.

pawn Код:
CMD:setplate(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 4)
        {  
            new szString[128], pVeh, Float:vPos[4],iVictim, szPlate[32];
            if( !IsPlayerInAnyVehicle( iVictim ) )return SendClientMessage( playerid, -1, "Error: That player isn't in a vehicle." );
            pVeh = GetPlayerVehicleID( iVictim );

            format( v_Plate[pVeh], 32, "%s", szPlate );
            SetVehicleNumberPlate( pVeh, szPlate );
     
            GetPlayerPos( iVictim, vPos[0], vPos[1], vPos[2] );
            GetVehicleZAngle( pVeh, vPos[3] );
            SetVehicleToRespawn( pVeh );
            SetVehiclePos( pVeh, vPos[0], vPos[1], vPos[2] );
            SetVehicleZAngle( pVeh, vPos[3] );
            PutPlayerInVehicle( iVictim, pVeh, 0 );
     
            format( szString, 128, "An administrator set your vehicle plate to %s.", szPlate );
            SendClientMessage( playerid, -1, szString );
     
            else return SendClientMessage(playerid, COLOR_RED, "Error: You are not an admin" );
        }
        else return SendClientMessage(playerid, COLOR_RED, "Error: That player isn't connected." );
    }
    return 1;
}



Re: AW: Scripting help - Johnny_Robins - 09.06.2012

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
pawn Код:
CMD:setplate( playerid, params[] )
{
        if(PlayerInfo[playerid][pAdmin] < 4) return SCM(playerid, -1, "You're not an level 4 admin!"); // If player is below level 4 he will get this message, and command won't work.
        new iVictim, szPlate[32];
        if( sscanf( params, "us[32]", iVictim, szPlate ) )
            return SendClientMessage( playerid, -1, "Syntax: /plate [playerid][plate(1-32 letters)]" );
 
        if( strlen( szPlate ) > 32 )
            return SendClientMessage( playerid, -1, "Syntax: /plate [playerid][plate(1-32 letters)]" );
 
        if( !IsPlayerAdmin( playerid ) )
            return SendClientMessage( playerid, -1, "Error: You're not an administrator." );
 
        if( !IsPlayerConnected( iVictim ) )
            return SendClientMessage( playerid, -1, "Error: That player isn't connected." );
 
        if( !IsPlayerInAnyVehicle( iVictim ) )
            return SendClientMessage( playerid, -1, "Error: That player isn't in a vehicle." );
 
        new szString[128], pVeh, Float:vPos[4];
        pVeh = GetPlayerVehicleID( iVictim );
 
        format( v_Plate[pVeh], 32, "%s", szPlate );
        SetVehicleNumberPlate( pVeh, szPlate );
 
        GetPlayerPos( iVictim, vPos[0], vPos[1], vPos[2] );
        GetVehicleZAngle( pVeh, vPos[3] );
        SetVehicleToRespawn( pVeh );
        SetVehiclePos( pVeh, vPos[0], vPos[1], vPos[2] );
        SetVehicleZAngle( pVeh, vPos[3] );
        PutPlayerInVehicle( iVictim, pVeh, 0 );
 
        format( szString, 128, "An administrator set your vehicle plate to %s.", szPlate );
        SendClientMessage( playerid, -1, szString );
 
        return 1;
}
Try this.
C:\Users\****\Desktop\Roleplay\[Windows]Roleplay\gamemodes\FSRP.pwn(42085) : error 017: undefined symbol "SCM"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


Re: Scripting help - Faisal_khan - 09.06.2012

Replace SCM with SendClientMessage