GivePlayerWeapon Problem

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Guten Tag, liebes Breadfish Forum.


    Ich bin derzeit an einem TDM Script am arbeiten (Selfmade) und habe ein Problem bei der Waffen vergabe.


    Wenn man sich eine Klasse auswählt, soll man mit verschiedenen Waffen spawnen.


    Wir haben mehrere Klassen, z.B Assault oder Destroyer.



    if(GunInfo[playerid] == 1)//Assault
    {
    GivePlayerWeapon(playerid,24,100);
    GivePlayerWeapon(playerid,29,300);
    GivePlayerWeapon(playerid,31,300);
    GivePlayerWeapon(playerid,16,3);
    return 1;
    }
    if(GunInfo[playerid] == 2)//Destroy
    {
    GivePlayerWeapon(playerid,24,100);
    GivePlayerWeapon(playerid,27,100);
    GivePlayerWeapon(playerid,29,300);
    GivePlayerWeapon(playerid,16,3);
    return 1;
    }
    if(GunInfo[playerid] == 3)//Sniper
    {
    GivePlayerWeapon(playerid,24,100);
    GivePlayerWeapon(playerid,34,50);
    GivePlayerWeapon(playerid,29,300);
    GivePlayerWeapon(playerid,16,3);
    return 1;
    }
    if(GunInfo[playerid] == 4)
    {
    GivePlayerWeapon(playerid,24,100);
    GivePlayerWeapon(playerid,35,5);
    GivePlayerWeapon(playerid,29,150);
    return 1;
    }


    GunInfo verändert sich wenn man nen Skin wechselt bei OnPlayerRequestClass:



    if(Spieler[playerid][Eingeloggt] == 1)
    {
    switch(classid)
    {
    case 0://Anti-Terror
    {
    ClearPlayerChat(playerid);
    GameTextForPlayer(playerid,"~b~Counter-Terrorists",1000,4);
    SendClientMessage(playerid,COLOR_BLUE,"|____ Equip-Assault ____|");
    SendClientMessage(playerid,COLOR_WHITE,"Desert Eagle - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"MP5 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"M4 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Grenades - 3");
    GunInfo[playerid] = 1;
    SetPlayerTeam(playerid,1);
    }
    case 1:
    {
    ClearPlayerChat(playerid);
    GameTextForPlayer(playerid,"~b~Counter-Terrorists",1000,4);
    SendClientMessage(playerid,COLOR_BLUE,"|____ Equip-Destroyer ____|");
    SendClientMessage(playerid,COLOR_WHITE,"Desert Eagle - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Combat Shotgun - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"MP5 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Grenades - 3");
    SetPlayerTeam(playerid,1);
    GunInfo[playerid] = 2;
    }
    case 2:
    {
    ClearPlayerChat(playerid);
    GameTextForPlayer(playerid,"~b~Counter-Terrorists",1000,4);
    SendClientMessage(playerid,COLOR_BLUE,"|____ Equip-Sniper ____|");
    SendClientMessage(playerid,COLOR_WHITE,"Desert Eagle - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Sniper - 50 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"MP5 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Grenades - 3");
    SetPlayerTeam(playerid,1);
    GunInfo[playerid] = 3;
    }
    case 3:
    {
    ClearPlayerChat(playerid);
    GameTextForPlayer(playerid,"~b~Counter-Terrorists",1000,4);
    SendClientMessage(playerid,COLOR_BLUE,"|____ Equip-Heavy Trooper ____|");
    SendClientMessage(playerid,COLOR_WHITE,"Desert Eagle - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Rocket Launcher - 5 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"MP5 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Grenades - 3");
    SetPlayerTeam(playerid,1);
    GunInfo[playerid] = 4;
    }
    case 4://Terror
    {
    ClearPlayerChat(playerid);
    GameTextForPlayer(playerid,"~r~Terrorists",1000,4);
    SendClientMessage(playerid,COLOR_BLUE,"|____ Equip-Assault ____|");
    SendClientMessage(playerid,COLOR_WHITE,"Desert Eagle - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"MP5 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"M4 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Grenades - 3");
    SetPlayerTeam(playerid,2);
    GunInfo[playerid] = 1;
    }
    case 5:
    {
    ClearPlayerChat(playerid);
    GameTextForPlayer(playerid,"~r~Terrorists",1000,4);
    SendClientMessage(playerid,COLOR_BLUE,"|____ Equip-Destroyer ____|");
    SendClientMessage(playerid,COLOR_WHITE,"Desert Eagle - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Combat Shotgun - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"MP5 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Grenades - 3");
    SetPlayerTeam(playerid,2);
    GunInfo[playerid] = 2;
    }
    case 6:
    {
    ClearPlayerChat(playerid);
    GameTextForPlayer(playerid,"~r~Terrorists",1000,4);
    SendClientMessage(playerid,COLOR_BLUE,"|____ Equip-Sniper ____|");
    SendClientMessage(playerid,COLOR_WHITE,"Desert Eagle - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Sniper - 50 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"MP5 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Grenades - 3");
    SetPlayerTeam(playerid,2);
    GunInfo[playerid] = 3;
    }
    case 7:
    {
    ClearPlayerChat(playerid);
    GameTextForPlayer(playerid,"~r~Terrorists",1000,4);
    SendClientMessage(playerid,COLOR_BLUE,"|____ Equip-Heavy Trooper ____|");
    SendClientMessage(playerid,COLOR_WHITE,"Desert Eagle - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Rocket Launcher - 5 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"MP5 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Grenades - 3");
    SetPlayerTeam(playerid,2);
    GunInfo[playerid] = 4;
    }
    }


    Nur beim Spawn erhält man leider keine Waffen deshalb wollte ich fragen ob ihr mir dabei helfen könnt? :/


    Nicht wundern, ist eine Englische Gamemode. ;)

  • if(!strcmp(cmd,"/debug",true))
    {
    new _debug[10];
    format(_debug,sizeof _debug,"Debug: %d", GunInfo[playerid]);
    return SendClientMessage(playerid,0xFF0000FF,_debug);
    }


    Evt mal probieren


    if(GunInfo[playerid] == 1)//Assault
    {
    GivePlayerWeapon(playerid,24,100);
    GivePlayerWeapon(playerid,29,300);
    GivePlayerWeapon(playerid,31,300);
    GivePlayerWeapon(playerid,16,3);
    return 1;
    }
    else if(GunInfo[playerid] == 2)//Destroy
    {
    GivePlayerWeapon(playerid,24,100);
    GivePlayerWeapon(playerid,27,100);
    GivePlayerWeapon(playerid,29,300);
    GivePlayerWeapon(playerid,16,3);
    return 1;
    }
    else if(GunInfo[playerid] == 3)//Sniper
    {
    GivePlayerWeapon(playerid,24,100);
    GivePlayerWeapon(playerid,34,50);
    GivePlayerWeapon(playerid,29,300);
    GivePlayerWeapon(playerid,16,3);
    return 1;
    }
    else
    {
    GivePlayerWeapon(playerid,24,100);
    GivePlayerWeapon(playerid,35,5);
    GivePlayerWeapon(playerid,29,150);
    return 1;
    }


    Und wo werden die Waffen denn gegeben? Bei welchen Public..

  • GameTextForPlayer(playerid,"~b~Counter-Terrorists",1000,4);
    SendClientMessage(playerid,COLOR_BLUE,"|____ Equip-Assault ____|");
    SendClientMessage(playerid,COLOR_WHITE,"Desert Eagle - 100 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"MP5 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"M4 - 300 Ammo");
    SendClientMessage(playerid,COLOR_WHITE,"Grenades - 3");

    Füg doch mal hier GivePlayerWeapon ein.


    lg


    pS