#1

1.my command is bug

PHP код:
CMD:dm(PIDparams[])
{
    new 
string[128], playerName[MAX_PLAYER_NAME];
    
GetPlayerName(PIDplayerNamesizeof(playerName));
    if(
InDM[PID] == true// Once again, if they're in a DM arena.
    
{
        return 
scm(PID, -1"You're already in a DM arena. (/dmleave)"); // They can't join if they're already in an arena, that wouldn't make sense.
    
}
    else if(
sscanf(params,"i",DM[PID])) return scm(PID, -1"USAGE: /dm <zoneID> (/dmlist)"); // We use sscanf to look for an integer value provided by the user when they type DM as a command.
    
{
        switch (
DM[PID]) // We switch through cases in search of the provided integer. As I said, you can add as many as you like. You could get more in depth and check to see if the DM they provide is valid. But this is a simple tutorial.
        
{
            case 
0:
            {
                
InDM[PID] = true;
                
DM[PID] = 0;
                
SpawnPlayer(PID);
                
SetPlayerInterior(playerid17);
                
SetPlayerVirtualWorld(PID1);
            }
        }
        
format(stringsizeof(string), "{77B3D9}[DM Zones] {ffffff}%s(%i) has just entered {77B3D9}DM zone %i {ffffff}(/dm)"playerNamePIDDM[PID]);
        
scms(-1string); 
     }
    return 
1;

the bug is:i have 1 room deathmatch but if i type 2 room,the sendclientmesseage show but no show (you type wrong room name)

2.the crash detect show this
Quote:

[15:48:56] [debug] Run time error 4: "Array index out of bounds"
[15:48:56] [debug] Attempted to read/write array element at negative index -400
[15:48:56] [debug] AMX backtrace:
[15:48:56] [debug] #0 00083ea4 in public OnPlayerModelSelection (playerid=0, response=1, listid=5, modelid=552) at C:\Users\cyber\Desktop\pawn v2.0\lel.pwn:1452
[15:48:56] [debug] #1 native CallLocalFunction () from samp-server.exe
[15:48:56] [debug] #2 00072648 in public OnPlayerClickPlayerTextDraw (playerid=0, PlayerTextlayertextid=32) at H:\gta server cc bukit\pawno\include\mSelection.inc:574

Reply
#2

help
Reply
#3

What room id do you have?
Reply
#4

i have only 1 room.it should say no room when i type room 2
Reply
#5

You used sscanf wrong...
It should be like:
PHP код:
CMD:dm(playerid,params[])
{
  
//some code here... IDK
   
if(sscanf(params[],"i",DM[playerid]))
   {
       
scm(playerid,-1,"Usage: /dm dm_zone_id"); //Just an example... If typed "/dm string" "/dm" etc
       
return 1;
   }
   
//rest of the code (if playerid typed "/dm N", N means number)

Reply
#6

what do you mean
Reply
#7

anyone
Reply
#8

Help
Reply
#9

Are the two problems related?

Show line 1452.
Reply
#10

PHP код:
public OnPlayerModelSelection(PIDresponselistidmodelid)
{
    new 
VWINT;
    if(
listid == Airplanes || listid == Bikes || listid == Boats || listid == Convertible || listid == Helicopters || listid == Industrials || listid == Lowrider || listid == OffRoad || listid == PublicService || listid == RC || listid == Saloon || listid == Sports || listid == StationWagon || listid == Trailer || listid == Unique)
    {
        if(
response)
        {
            
DestroyVehicle(playerCar[PID]);
            new 
Float:pos[4], color[2];
            
GetPlayerPos(PIDpos[0], pos[1], pos[2]);
            
GetPlayerFacingAngle(PIDpos[3]);
            
color[0] = random(256);  // the error code
            
color[1] = random(256);
            
playerCar[PID] = CreateVehicle(modelidpos[0], pos[1], pos[2]+2.0pos[3], color[0], color[1], -1);
            
VW GetPlayerVirtualWorld(PID);
            
INT GetPlayerInterior(PID);
            
SetVehicleVirtualWorld(playerCar[PID], VW);
            
LinkVehicleToInterior(playerCar[PID], INT);
            
PutPlayerInVehicle(PIDplayerCar[PID], 0);
            
scm(PID0xFF0000FF""red"[Vehicle] "grey"vehicle Spawned.");
        }
        else 
scm(PID0xFF0000FF""red"[Vehicle] "grey"Canceled selection.");
        return 
1;
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)