Help Me in Script GameText +Rep
#1

Hello Guys
i Want Know How To Put name player in GameText When i Kidnap him [You kidnaped From %]
And the kidnaper GameText for him [You Kidnaped %]

And How to make money after he is in The Random CP With this float
Take Money when he is in The CP
PHP код:
new Float:Kidnap[][3] =
{
    {
213.8458,1867.2299,13.1406},
    {
404.7588,2443.3687,16.5000},
    {
760.2078,381.6906,23.1719},
    {-
777.8541,1436.0165,13.7891}
}; 
And i Can Make it Better! cuz there much script i will add in Float
Help +Repsss
Reply
#2

in the command to kidnap, do the following:

pawn Код:
new string[128], name[MAX_PLAYER_NAME];

GetPlayerName(otherplayer, name, sizeof(name)); //replace otherplayer with whatever the target id is called
format(string, sizeof(string), "You kidnapped %s", name);
GameTextForPlayer(playerid, string, 5000, 2);
Reply
#3

pawn Код:
//For Kidnapper:
new string[128], Name[MAX_PLAYER_NAME], pName[MAX_PLAYERS];

GetPlayerName(Victimid, Name, sizeof(Name));
format(string, sizeof(string), "You kidnapped %s", Name);
GameTextForPlayer(playerid, string, 5000, 2);

//for Victim:
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "You kidnaped From %s", pName);
GameTextForPlayer(Victimid, string, 5000, 2);
Reply
#4

Quote:
Originally Posted by TakeiT
Посмотреть сообщение
in the command to kidnap, do the following:

pawn Код:
new string[128], name[MAX_PLAYER_NAME];

GetPlayerName(otherplayer, name, sizeof(name)); //replace otherplayer with whatever the target id is called
format(string, sizeof(string), "You kidnapped %s", name);
GameTextForPlayer(playerid, string, 5000, 2);
error
Quote:

F:\New Folder (2)\ffffffff\pawno\include\sscanf2.inc(199) : warning 219: local variable "name" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\pawno\include\sscanf2.inc(305) : warning 219: local variable "string" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\pawno\include\sscanf2.inc(305) : warning 219: local variable "string" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\pawno\include\sscanf2.inc(365) : warning 219: local variable "string" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\pawno\include\sscanf2.inc(365) : warning 219: local variable "string" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\filterscripts\kidnap2.pwn(29) : error 017: undefined symbol "otherplayer"

this my code kidnap
PHP код:
CMD:kidnap(playeridparams[])
{
    new 
targetid;
    if(
sscanf(params,"d",targetid)) return SendClientMessage(playerid0xFF0000FF"USAGE: /kidnap [id]");
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid0xFF0000FF"ERROR: You must be on vehicle!");
    if(
noexit[targetid] == 1noexit[targetid] = 0;
    
noexit[targetid] = 1;
    
PutPlayerInVehicle(targetidGetPlayerVehicleID(playerid), 1);
    new 
rand random(sizeof(Kidnap));
    
SetPlayerPos(playeridKidnap[rand][0], Kidnap[rand][1], Kidnap[rand][2]);
    
SendClientMessage(targetidCOLOR_RED"You Can Out /Cutrope");
    return 
1;

Reply
#5

pawn Код:
CMD:kidnap(playerid, params[])
{
    new targetid;
    if(sscanf(params,"d",targetid)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /kidnap [id]");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must be on vehicle!");
    if(noexit[targetid] == 1) noexit[targetid] = 0;
    noexit[targetid] = 1;
    PutPlayerInVehicle(targetid, GetPlayerVehicleID(playerid), 1);
    new rand = random(sizeof(Kidnap));
    SetPlayerPos(playerid, Kidnap[rand][0], Kidnap[rand][1], Kidnap[rand][2]);
    SendClientMessage(targetid, COLOR_RED, "You Can Out /Cutrope");

    new string[128], Name[MAX_PLAYER_NAME], pName[MAX_PLAYERS];

    GetPlayerName(targetid, Name, sizeof(Name));
    format(string, sizeof(string), "You kidnapped %s", Name);
    GameTextForPlayer(playerid, string, 5000, 2);

    //for Victim:
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "You kidnaped From %s", pName);
    GameTextForPlayer(targetid, string, 5000, 2);

    return 1;
}
Reply
#6

Quote:
Originally Posted by Shaktimaan
Посмотреть сообщение
pawn Код:
CMD:kidnap(playerid, params[])
{
    new targetid;
    if(sscanf(params,"d",targetid)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /kidnap [id]");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must be on vehicle!");
    if(noexit[targetid] == 1) noexit[targetid] = 0;
    noexit[targetid] = 1;
    PutPlayerInVehicle(targetid, GetPlayerVehicleID(playerid), 1);
    new rand = random(sizeof(Kidnap));
    SetPlayerPos(playerid, Kidnap[rand][0], Kidnap[rand][1], Kidnap[rand][2]);
    SendClientMessage(targetid, COLOR_RED, "You Can Out /Cutrope");

    new string[128], Name[MAX_PLAYER_NAME], pName[MAX_PLAYERS];

    GetPlayerName(targetid, Name, sizeof(Name));
    format(string, sizeof(string), "You kidnapped %s", Name);
    GameTextForPlayer(playerid, string, 5000, 2);

    //for Victim:
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "You kidnaped From %s", pName);
    GameTextForPlayer(targetid, string, 5000, 2);

    return 1;
}
see the error :/
Quote:

F:\New Folder (2)\ffffffff\pawno\include\sscanf2.inc(305) : warning 219: local variable "string" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\pawno\include\sscanf2.inc(305) : warning 219: local variable "string" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\pawno\include\sscanf2.inc(365) : warning 219: local variable "string" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\pawno\include\sscanf2.inc(365) : warning 219: local variable "string" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\filterscripts\kidnap2.pwn(31) : warning 219: local variable "string" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\filterscripts\kidnap2.pwn(31) : warning 219: local variable "Name" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\filterscripts\kidnap2.pwn(31) : warning 219: local variable "pName" shadows a variable at a preceding level
F:\New Folder (2)\ffffffff\filterscripts\kidnap2.pwn(45) : warning 203: symbol is never used: "Name"
F:\New Folder (2)\ffffffff\filterscripts\kidnap2.pwn(45) : warning 203: symbol is never used: "pName"
F:\New Folder (2)\ffffffff\filterscripts\kidnap2.pwn(45) : warning 203: symbol is never used: "string"

line 2 =
PHP код:
#include <zcmd> 
Reply
#7

See that if you have used all the variables correctly or not.
Reply
#8

-_-
pawn Код:
stock pName(playerid)
{
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
  return name;
}

CMD:kidnap(playerid, params[])
{
    new targetid;
    if(sscanf(params,"d",targetid)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /kidnap [id]");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must be on vehicle!");
    if(noexit[targetid] == 1) noexit[targetid] = 0;
    noexit[targetid] = 1;
    PutPlayerInVehicle(targetid, GetPlayerVehicleID(playerid), 1);
    new rand = random(sizeof(Kidnap));
    SetPlayerPos(playerid, Kidnap[rand][0], Kidnap[rand][1], Kidnap[rand][2]);
    SendClientMessage(targetid, COLOR_RED, "You Can Out /Cutrope");

    new String[128];

    format(String, sizeof(String), "You kidnapped %s", pName(targetid));
    GameTextForPlayer(playerid, String, 5000, 2);

    //for Victim:
    format(String, sizeof(String), "You kidnaped From %s", pName(playerid));
    GameTextForPlayer(targetid, String, 5000, 2);

    return 1;
}
Reply
#9

Quote:
Originally Posted by Shaktimaan
Посмотреть сообщение
-_-
pawn Код:
stock pName(playerid)
{
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
  return name;
}

CMD:kidnap(playerid, params[])
{
    new targetid;
    if(sscanf(params,"d",targetid)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /kidnap [id]");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You must be on vehicle!");
    if(noexit[targetid] == 1) noexit[targetid] = 0;
    noexit[targetid] = 1;
    PutPlayerInVehicle(targetid, GetPlayerVehicleID(playerid), 1);
    new rand = random(sizeof(Kidnap));
    SetPlayerPos(playerid, Kidnap[rand][0], Kidnap[rand][1], Kidnap[rand][2]);
    SendClientMessage(targetid, COLOR_RED, "You Can Out /Cutrope");

    new String[128];

    format(String, sizeof(String), "You kidnapped %s", pName(targetid));
    GameTextForPlayer(playerid, String, 5000, 2);

    //for Victim:
    format(String, sizeof(String), "You kidnaped From %s", pName(playerid));
    GameTextForPlayer(targetid, String, 5000, 2);

    return 1;
}
thanks u i rep u fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)